Update 1.9.2 docker-api-1 has error Failed to generate name after answer, use query instead #19910

Closed
opened 2026-02-21 20:04:53 -05:00 by yindo · 4 comments
Owner

Originally created by @aijuntao on GitHub (Oct 24, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Update 1.9.2 docker-api-1 has error Failed to generate name after answer, use query instead ERROR [Thread-4666 (_generate_conversation_name_worker)] [llm_generator.py:80] - Failed to generate name after answer, use query instead
Traceback (most recent call last):
File "/app/api/core/llm_generator/llm_generator.py", line 77, in generate_conversation_name
result_dict = json.loads(cleaned_answer)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/decoder.py", line 338, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/decoder.py", line 356, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

✔️ Expected Behavior

solve problems

Actual Behavior

No response

Originally created by @aijuntao on GitHub (Oct 24, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Update 1.9.2 docker-api-1 has error Failed to generate name after answer, use query instead ERROR [Thread-4666 (_generate_conversation_name_worker)] [llm_generator.py:80] - Failed to generate name after answer, use query instead Traceback (most recent call last): File "/app/api/core/llm_generator/llm_generator.py", line 77, in generate_conversation_name result_dict = json.loads(cleaned_answer) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/json/decoder.py", line 338, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/json/decoder.py", line 356, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ### ✔️ Expected Behavior solve problems ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 20:04:53 -05:00
yindo closed this issue 2026-02-21 20:04:54 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 24, 2025):

The error happens because the LLM sometimes returns a response that isn't valid JSON, so json.loads(cleaned_answer) fails and triggers the fallback to using the query as the conversation name. This is a known issue in Dify's conversation name generation logic: the code tries to extract a JSON object from the LLM's response using a regex, but this isn't reliable for all model outputs. When parsing fails, Dify logs the error and uses the query as the name, which is what you're seeing "source" "discussion".

To reduce these errors:

  • Make sure your LLM prompt explicitly instructs the model to return strict JSON with double-quoted property names.
  • If you control the model or adapter, ensure it outputs valid JSON.
  • If you're using a model with deep reasoning (like deepseek-R1 or qwq), consider switching to a direct response model for conversation name generation, or increase the max_token value in generate_conversation_name "discussion".
  • For debugging, log the raw LLM response right after the LLM call in llm_generator.py to see what the model is returning before parsing.

If you have HTTP_PROXY set in your Docker environment, make sure you also set the NO_PROXY variable to include internal services like weaviate,qdrand,db,redis,web,worker,plugin_daemon to avoid network issues that can cause empty responses "discussion".

The fallback to using the query is intentional to prevent crashes, but if you want more robust handling, you could add validation or retry logic to re-prompt for valid JSON when parsing fails.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Oct 24, 2025): <!-- Answer --> The error happens because the LLM sometimes returns a response that isn't valid JSON, so `json.loads(cleaned_answer)` fails and triggers the fallback to using the query as the conversation name. This is a known issue in Dify's conversation name generation logic: the code tries to extract a JSON object from the LLM's response using a regex, but this isn't reliable for all model outputs. When parsing fails, Dify logs the error and uses the query as the name, which is what you're seeing ["source"](https://github.com/langgenius/dify/blob/a715d5ac23657100a45f5a68ffbbc0cd2bc332ff/api/core/llm_generator/llm_generator.py) ["discussion"](https://github.com/langgenius/dify/issues/25634). To reduce these errors: - Make sure your LLM prompt explicitly instructs the model to return strict JSON with double-quoted property names. - If you control the model or adapter, ensure it outputs valid JSON. - If you're using a model with deep reasoning (like deepseek-R1 or qwq), consider switching to a direct response model for conversation name generation, or increase the `max_token` value in `generate_conversation_name` ["discussion"](https://github.com/langgenius/dify/issues/17404). - For debugging, log the raw LLM response right after the LLM call in `llm_generator.py` to see what the model is returning before parsing. If you have HTTP_PROXY set in your Docker environment, make sure you also set the `NO_PROXY` variable to include internal services like `weaviate,qdrand,db,redis,web,worker,plugin_daemon` to avoid network issues that can cause empty responses ["discussion"](https://github.com/langgenius/dify/issues/14608). The fallback to using the query is intentional to prevent crashes, but if you want more robust handling, you could add validation or retry logic to re-prompt for valid JSON when parsing fails. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/27424)
Author
Owner

@aijuntao commented on GitHub (Oct 24, 2025):

@

The error happens because the LLM sometimes returns a response that isn't valid JSON, so json.loads(cleaned_answer) fails and triggers the fallback to using the query as the conversation name. This is a known issue in Dify's conversation name generation logic: the code tries to extract a JSON object from the LLM's response using a regex, but this isn't reliable for all model outputs. When parsing fails, Dify logs the error and uses the query as the name, which is what you're seeing "source" "discussion".

To reduce these errors:

  • Make sure your LLM prompt explicitly instructs the model to return strict JSON with double-quoted property names.
  • If you control the model or adapter, ensure it outputs valid JSON.
  • If you're using a model with deep reasoning (like deepseek-R1 or qwq), consider switching to a direct response model for conversation name generation, or increase the max_token value in generate_conversation_name "discussion".
  • For debugging, log the raw LLM response right after the LLM call in llm_generator.py to see what the model is returning before parsing.

If you have HTTP_PROXY set in your Docker environment, make sure you also set the NO_PROXY variable to include internal services like weaviate,qdrand,db,redis,web,worker,plugin_daemon to avoid network issues that can cause empty responses "discussion".

The fallback to using the query is intentional to prevent crashes, but if you want more robust handling, you could add validation or retry logic to re-prompt for valid JSON when parsing fails.

To reply, just mention @dosu.

How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

Can you tell me where to configure the model used by generate_versation_namew_worker?

@aijuntao commented on GitHub (Oct 24, 2025): @ > The error happens because the LLM sometimes returns a response that isn't valid JSON, so `json.loads(cleaned_answer)` fails and triggers the fallback to using the query as the conversation name. This is a known issue in Dify's conversation name generation logic: the code tries to extract a JSON object from the LLM's response using a regex, but this isn't reliable for all model outputs. When parsing fails, Dify logs the error and uses the query as the name, which is what you're seeing ["source"](https://github.com/langgenius/dify/blob/a715d5ac23657100a45f5a68ffbbc0cd2bc332ff/api/core/llm_generator/llm_generator.py) ["discussion"](https://github.com/langgenius/dify/issues/25634). > > To reduce these errors: > > * Make sure your LLM prompt explicitly instructs the model to return strict JSON with double-quoted property names. > * If you control the model or adapter, ensure it outputs valid JSON. > * If you're using a model with deep reasoning (like deepseek-R1 or qwq), consider switching to a direct response model for conversation name generation, or increase the `max_token` value in `generate_conversation_name` ["discussion"](https://github.com/langgenius/dify/issues/17404). > * For debugging, log the raw LLM response right after the LLM call in `llm_generator.py` to see what the model is returning before parsing. > > If you have HTTP_PROXY set in your Docker environment, make sure you also set the `NO_PROXY` variable to include internal services like `weaviate,qdrand,db,redis,web,worker,plugin_daemon` to avoid network issues that can cause empty responses ["discussion"](https://github.com/langgenius/dify/issues/14608). > > The fallback to using the query is intentional to prevent crashes, but if you want more robust handling, you could add validation or retry logic to re-prompt for valid JSON when parsing fails. > > _To reply, just mention [@dosu](https://go.dosu.dev/dosubot)._ > > How did I do? [Good](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d84b1c95-e3d3-4ecc-8e35-d74be15c3dfe?feedback_type=other)  [![Chat with Dosu](https://camo.githubusercontent.com/d9ffebb979729c9ef0fc4e3090dbae5b17cabbfec8afe378ada6b81913d6ad8a/68747470733a2f2f646f73752e6465762f646f73752d636861742d62616467652e737667)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github) [![Join Discord](https://camo.githubusercontent.com/d562c2df5e4567ea41d37f1d91a4da0839d8341037045b103b2da268998de17f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot) [![Share on X](https://camo.githubusercontent.com/4649f705e2396d6f328dbc8e800a0509c9c17b3b20253b36706c393df124b93d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/27424) Can you tell me where to configure the model used by generate_versation_namew_worker?
Author
Owner

@aijuntao commented on GitHub (Oct 24, 2025):

@dosubot Can you tell me where to configure the model used by generate_versation_namew_worker?

@aijuntao commented on GitHub (Oct 24, 2025): @dosubot Can you tell me where to configure the model used by generate_versation_namew_worker?
Author
Owner

@dosubot[bot] commented on GitHub (Oct 24, 2025):

The model used by generate_conversation_name_worker is determined by the default LLM model configured for your tenant or system. You can set this in the Dify admin interface under system model settings or model provider settings. There isn't a separate config just for conversation name generation—the worker uses whatever default LLM model is set for your workspace. If you're seeing issues with conversation name generation (like JSON errors), try switching the default model to a non-reasoning or faster model in the system settings. This change will affect conversation name generation and can resolve related errors. For more details, see the discussion here: relevant issue and model selection in code.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Oct 24, 2025): <!-- Answer --> The model used by `generate_conversation_name_worker` is determined by the default LLM model configured for your tenant or system. You can set this in the Dify admin interface under system model settings or model provider settings. There isn't a separate config just for conversation name generation—the worker uses whatever default LLM model is set for your workspace. If you're seeing issues with conversation name generation (like JSON errors), try switching the default model to a non-reasoning or faster model in the system settings. This change will affect conversation name generation and can resolve related errors. For more details, see the discussion here: [relevant issue](https://github.com/langgenius/dify/issues/20082) and [model selection in code](https://github.com/langgenius/dify/blob/a715d5ac23657100a45f5a68ffbbc0cd2bc332ff/api/core/llm_generator/llm_generator.py). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/faa6c83c-a8f5-444c-8f0a-df18483e44a6?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/faa6c83c-a8f5-444c-8f0a-df18483e44a6?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/faa6c83c-a8f5-444c-8f0a-df18483e44a6?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/faa6c83c-a8f5-444c-8f0a-df18483e44a6?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/faa6c83c-a8f5-444c-8f0a-df18483e44a6?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/faa6c83c-a8f5-444c-8f0a-df18483e44a6?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/faa6c83c-a8f5-444c-8f0a-df18483e44a6?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/27424)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#19910