got invalid json object. error: Expecting ':' delimiter: line 2 column 16 (char 50) #16079

Closed
opened 2026-02-21 19:24:34 -05:00 by yindo · 11 comments
Owner

Originally created by @disguisetm on GitHub (Aug 12, 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.4.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

This is an occasional phenomenon where an error occurs when executing the problem classifier,Cannot reproduce, the same problem can be re executed without any issues
Image

Image Image Image

✔️ Expected Behavior

Can execute correctly or provide specific error messages

Actual Behavior

Process execution interruption

Originally created by @disguisetm on GitHub (Aug 12, 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.4.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce This is an occasional phenomenon where an error occurs when executing the problem classifier,Cannot reproduce, the same problem can be re executed without any issues <img width="1522" height="117" alt="Image" src="https://github.com/user-attachments/assets/5f00d656-93f4-4a7c-a7ba-63cd5850a31e" /> <img width="235" height="411" alt="Image" src="https://github.com/user-attachments/assets/86bac9cf-a7df-46e8-8553-38e32d27c919" /> <img width="480" height="829" alt="Image" src="https://github.com/user-attachments/assets/4a9ae73f-d99b-4ebd-a056-7bb7f012991e" /> <img width="472" height="496" alt="Image" src="https://github.com/user-attachments/assets/d9dcbf48-a830-42af-a9b5-d6cc25b777a4" /> ### ✔️ Expected Behavior Can execute correctly or provide specific error messages ### ❌ Actual Behavior Process execution interruption
yindo added the 🤔 cant-reproduceoutdated labels 2026-02-21 19:24:34 -05:00
yindo closed this issue 2026-02-21 19:24:34 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 12, 2025):

Hi @disguisetm! I'm Dosu and I’m helping the dify team.

This error happens when the LLM's output for the problem classifier isn't valid JSON—usually because of a formatting mistake like a missing colon between a key and value. The classifier expects a strict JSON object, and even with clear prompt instructions, LLMs sometimes return malformed JSON, which triggers this parsing error and interrupts execution. The error handling in Dify currently just reports the parsing failure without more detail.

A recent fix improved JSON serialization in the classifier prompt (PR #22997), and upgrading to Dify v1.4.2 or later has resolved similar JSON parsing issues for other users. If you must stay on v1.4.0, you can try making the prompt even more explicit about the required JSON format, or add post-processing to repair common JSON mistakes before parsing. If the issue persists, capturing and logging the raw LLM output that caused the error can help with further debugging.

For more context on how the classifier parses and validates JSON, see the classifier node code and JSON parser.

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 (Aug 12, 2025): <!-- Greeting --> Hi @disguisetm! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> This error happens when the LLM's output for the problem classifier isn't valid JSON—usually because of a formatting mistake like a missing colon between a key and value. The classifier expects a strict JSON object, and even with clear prompt instructions, LLMs sometimes return malformed JSON, which triggers this parsing error and interrupts execution. The error handling in Dify currently just reports the parsing failure without more detail. A recent fix improved JSON serialization in the classifier prompt ([PR #22997](https://github.com/langgenius/dify/pull/22997)), and upgrading to Dify v1.4.2 or later has resolved similar JSON parsing issues for other users. If you must stay on v1.4.0, you can try making the prompt even more explicit about the required JSON format, or add post-processing to repair common JSON mistakes before parsing. If the issue persists, capturing and logging the raw LLM output that caused the error can help with further debugging. For more context on how the classifier parses and validates JSON, see the [classifier node code](https://github.com/langgenius/dify/blob/de0dae9d9b98e5d39d672024c5bb43c721a7fcd6/api/core/workflow/nodes/question_classifier/question_classifier_node.py) and [JSON parser](https://github.com/langgenius/dify/blob/de0dae9d9b98e5d39d672024c5bb43c721a7fcd6/api/libs/json_in_md_parser.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/73ba4eed-7c7f-4f8a-9713-2a5476bd20ff?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/73ba4eed-7c7f-4f8a-9713-2a5476bd20ff?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/73ba4eed-7c7f-4f8a-9713-2a5476bd20ff?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/73ba4eed-7c7f-4f8a-9713-2a5476bd20ff?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/73ba4eed-7c7f-4f8a-9713-2a5476bd20ff?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/73ba4eed-7c7f-4f8a-9713-2a5476bd20ff?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/73ba4eed-7c7f-4f8a-9713-2a5476bd20ff?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/23804)
Author
Owner

@disguisetm commented on GitHub (Aug 12, 2025):

Can we prevent the node from reporting errors and allow the process node to continue executing, or follow the default classification after the error

@disguisetm commented on GitHub (Aug 12, 2025): Can we prevent the node from reporting errors and allow the process node to continue executing, or follow the default classification after the error
Author
Owner

@dosubot[bot] commented on GitHub (Aug 12, 2025):

Yes, you can configure the workflow so that if the question classifier node encounters an error (like invalid JSON), it doesn't stop the process. Dify nodes—including the classifier—support an error handling strategy: set continue_on_error to true and error_strategy to DEFAULT_VALUE, and provide a default_value for the node. With this setup, if a parsing error occurs, the node will output your predefined default classification and the workflow will continue instead of failing. This is supported in the workflow engine and node configuration, but you may need to edit the workflow definition directly if the UI doesn't expose these options in v1.4.0. For details, see the relevant code for error handling and default values here and here.

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 (Aug 12, 2025): <!-- Answer --> Yes, you can configure the workflow so that if the question classifier node encounters an error (like invalid JSON), it doesn't stop the process. Dify nodes—including the classifier—support an error handling strategy: set continue_on_error to true and error_strategy to DEFAULT_VALUE, and provide a default_value for the node. With this setup, if a parsing error occurs, the node will output your predefined default classification and the workflow will continue instead of failing. This is supported in the workflow engine and node configuration, but you may need to edit the workflow definition directly if the UI doesn't expose these options in v1.4.0. For details, see the relevant code for error handling and default values [here](https://github.com/langgenius/dify/blob/de0dae9d9b98e5d39d672024c5bb43c721a7fcd6/api/core/workflow/graph_engine/graph_engine.py) and [here](https://github.com/langgenius/dify/blob/de0dae9d9b98e5d39d672024c5bb43c721a7fcd6/api/core/workflow/nodes/base/entities.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/0463c34e-2914-45da-a5c5-3982c50ef30d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/0463c34e-2914-45da-a5c5-3982c50ef30d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/0463c34e-2914-45da-a5c5-3982c50ef30d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/0463c34e-2914-45da-a5c5-3982c50ef30d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0463c34e-2914-45da-a5c5-3982c50ef30d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/0463c34e-2914-45da-a5c5-3982c50ef30d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0463c34e-2914-45da-a5c5-3982c50ef30d?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/23804)
Author
Owner

@disguisetm commented on GitHub (Aug 12, 2025):

Where is the configuration for contue_on_error? Is it on the interface? I couldn't find the relevant configuration

@disguisetm commented on GitHub (Aug 12, 2025): Where is the configuration for contue_on_error? Is it on the interface? I couldn't find the relevant configuration
Author
Owner

@dosubot[bot] commented on GitHub (Aug 12, 2025):

The continue_on_error setting isn't available in the Dify v1.4.0 UI. It's an internal configuration that you need to set directly in the workflow definition (such as the workflow JSON or via API), not through the visual interface. To enable error-tolerant execution for a node (like the question classifier), you would add or edit the node's config to include:

{
  "error_strategy": "DEFAULT_VALUE",
  "default_value": [
    { "key": "class_name", "value": "your_default_class" },
    { "key": "class_id", "value": "your_default_id" }
  ],
  "continue_on_error": true
}

This config should be placed in the relevant node's section of your workflow definition. The workflow engine will then use your default value and continue execution if an error occurs, instead of stopping the workflow. For more details, see the workflow engine and node config handling in the codebase (graph_engine.py, entities.py).

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 (Aug 12, 2025): <!-- Answer --> The `continue_on_error` setting isn't available in the Dify v1.4.0 UI. It's an internal configuration that you need to set directly in the workflow definition (such as the workflow JSON or via API), not through the visual interface. To enable error-tolerant execution for a node (like the question classifier), you would add or edit the node's config to include: ```json { "error_strategy": "DEFAULT_VALUE", "default_value": [ { "key": "class_name", "value": "your_default_class" }, { "key": "class_id", "value": "your_default_id" } ], "continue_on_error": true } ``` This config should be placed in the relevant node's section of your workflow definition. The workflow engine will then use your default value and continue execution if an error occurs, instead of stopping the workflow. For more details, see the workflow engine and node config handling in the codebase ([graph_engine.py](https://github.com/langgenius/dify/blob/de0dae9d9b98e5d39d672024c5bb43c721a7fcd6/api/core/workflow/graph_engine/graph_engine.py), [entities.py](https://github.com/langgenius/dify/blob/de0dae9d9b98e5d39d672024c5bb43c721a7fcd6/api/core/workflow/nodes/base/entities.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/971b36d9-ae59-4cfa-b36b-0934ecc16b1e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/971b36d9-ae59-4cfa-b36b-0934ecc16b1e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/971b36d9-ae59-4cfa-b36b-0934ecc16b1e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/971b36d9-ae59-4cfa-b36b-0934ecc16b1e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/971b36d9-ae59-4cfa-b36b-0934ecc16b1e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/971b36d9-ae59-4cfa-b36b-0934ecc16b1e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/971b36d9-ae59-4cfa-b36b-0934ecc16b1e?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/23804)
Author
Owner

@disguisetm commented on GitHub (Aug 12, 2025):

Will this configuration be overwritten if the workflow is edited? I also didn't see it in the UI version 1.7.0

@disguisetm commented on GitHub (Aug 12, 2025): Will this configuration be overwritten if the workflow is edited? I also didn't see it in the UI version 1.7.0
Author
Owner

@liyongteng-pacvue commented on GitHub (Sep 3, 2025):

ImageI also encountered the same problem, is there any solution?

@liyongteng-pacvue commented on GitHub (Sep 3, 2025): <img width="1074" height="768" alt="Image" src="https://github.com/user-attachments/assets/f5a6942d-07b4-4f77-8afc-7a2bdf185ad8" />I also encountered the same problem, is there any solution?
Author
Owner

@disguisetm commented on GitHub (Sep 3, 2025):

I tried this method, but it didn't work
{ "error_strategy": "DEFAULT_VALUE", "default_value": [ { "key": "class_name", "value": "your_default_class" }, { "key": "class_id", "value": "your_default_id" } ], "continue_on_error": true }
Finally, the constraint is further enforced through prompt words, but it is still not stable enough and this error may still occur

@disguisetm commented on GitHub (Sep 3, 2025): I tried this method, but it didn't work `{ "error_strategy": "DEFAULT_VALUE", "default_value": [ { "key": "class_name", "value": "your_default_class" }, { "key": "class_id", "value": "your_default_id" } ], "continue_on_error": true }` Finally, the constraint is further enforced through prompt words, but it is still not stable enough and this error may still occur
Author
Owner

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

Hi, @disguisetm. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported intermittent JSON parsing errors ("Expecting ':' delimiter") during problem classifier execution in Dify v1.4.0 self-hosted via Docker.
  • The error is caused by malformed LLM output JSON, leading to workflow failures.
  • Suggested workarounds included upgrading to v1.4.2+ or adding explicit prompt constraints, and configuring nodes with continue_on_error and error_strategy set to DEFAULT_VALUE.
  • You tried the configuration workaround but found it ineffective, and the issue persists despite stricter prompt constraints.
  • Another user also reported experiencing the same problem.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
  • Otherwise, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Oct 4, 2025): Hi, @disguisetm. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported intermittent JSON parsing errors ("Expecting ':' delimiter") during problem classifier execution in Dify v1.4.0 self-hosted via Docker. - The error is caused by malformed LLM output JSON, leading to workflow failures. - Suggested workarounds included upgrading to v1.4.2+ or adding explicit prompt constraints, and configuring nodes with `continue_on_error` and `error_strategy` set to `DEFAULT_VALUE`. - You tried the configuration workaround but found it ineffective, and the issue persists despite stricter prompt constraints. - Another user also reported experiencing the same problem. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open. - Otherwise, this issue will be automatically closed in 15 days. Thank you for your understanding and contribution!
Author
Owner

@luoMonkeyKing commented on GitHub (Oct 11, 2025):

I also encountered the same problem, how to solve it?

Image
@luoMonkeyKing commented on GitHub (Oct 11, 2025): I also encountered the same problem, how to solve it? <img width="732" height="552" alt="Image" src="https://github.com/user-attachments/assets/73aacfdb-11f3-43e4-9fd3-2e4132998f1b" />
Author
Owner

@luoMonkeyKing commented on GitHub (Oct 11, 2025):

我尝试了这个方法,但是没有效果 { "error_strategy": "DEFAULT_VALUE", "default_value": [ { "key": "class_name", "value": "your_default_class" }, { "key": "class_id", "value": "your_default_id" } ], "continue_on_error": true } 最后通过提示词进一步强制约束,但是还是不够稳定,可能还是会出现这个错误

Hi, how did you add this prompt words?

@luoMonkeyKing commented on GitHub (Oct 11, 2025): > 我尝试了这个方法,但是没有效果 `{ "error_strategy": "DEFAULT_VALUE", "default_value": [ { "key": "class_name", "value": "your_default_class" }, { "key": "class_id", "value": "your_default_id" } ], "continue_on_error": true }` 最后通过提示词进一步强制约束,但是还是不够稳定,可能还是会出现这个错误 Hi, how did you add this prompt words?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#16079