Failed to transform agent message ... JSONDecodeError #757

Closed
opened 2026-02-16 10:20:24 -05:00 by yindo · 1 comment
Owner

Originally created by @vvhr on GitHub (Oct 29, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues Dify issues & Dify Official Plugins, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.2

Plugin version

0.0.25

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

✔️ Error log

Agent Failed: Failed to transform agent message: req_id: 3b276b8b6a PluginInvokeError: {"args":{},"error_type":"JSONDecodeError","message":"Extra data: line 1 column 32 (char 31)"}

Originally created by @vvhr on GitHub (Oct 29, 2025). ### Self Checks - [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 [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.2 ### Plugin version 0.0.25 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="833" height="719" alt="Image" src="https://github.com/user-attachments/assets/d55ba219-7256-4a6d-8514-e986dac1d8f0" /> ### ✔️ Error log **Agent Failed**: Failed to transform agent message: req_id: 3b276b8b6a PluginInvokeError: {"args":{},"error_type":"JSONDecodeError","message":"Extra data: line 1 column 32 (char 31)"}
yindo added the bug label 2026-02-16 10:20:24 -05:00
yindo closed this issue 2026-02-16 10:20:24 -05:00
Author
Owner

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

This error is caused by the agent message containing multiple JSON objects or extra data outside a single JSON object, which the parser can't handle. This is a known issue when models like Claude Haiku (especially with the FunctionCalling strategy) return outputs that aren't strictly a single JSON object—sometimes including trailing text or multiple JSON blocks. Recent Dify updates fixed similar JSON parsing bugs by stripping out extra tags (like <think>) and making the parser more robust to both {} and [] formats, but these fixes landed after v1.9.2 (details).

To work around this in your current version, check your agent/tool prompts to ensure they instruct the model to return only a single, clean JSON object with no extra text. If possible, upgrade to a newer Dify version where these parsing improvements are included. If you must stay on v1.9.2, you may need to patch your deployment to sanitize model outputs before parsing, or backport the relevant fixes from the recent PRs.

To reply, just mention @dosu.


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

@dosubot[bot] commented on GitHub (Oct 29, 2025): <!-- Answer --> This error is caused by the agent message containing multiple JSON objects or extra data outside a single JSON object, which the parser can't handle. This is a known issue when models like Claude Haiku (especially with the FunctionCalling strategy) return outputs that aren't strictly a single JSON object—sometimes including trailing text or multiple JSON blocks. Recent Dify updates fixed similar JSON parsing bugs by stripping out extra tags (like `<think>`) and making the parser more robust to both `{}` and `[]` formats, but these fixes landed after v1.9.2 ([details](https://github.com/langgenius/dify/pull/26992)). To work around this in your current version, check your agent/tool prompts to ensure they instruct the model to return only a single, clean JSON object with no extra text. If possible, upgrade to a newer Dify version where these parsing improvements are included. If you must stay on v1.9.2, you may need to patch your deployment to sanitize model outputs before parsing, or backport the relevant fixes from the recent PRs. <!-- 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/e294dbc7-a1e5-4b6b-82ca-0625a17ead17?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/e294dbc7-a1e5-4b6b-82ca-0625a17ead17?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/e294dbc7-a1e5-4b6b-82ca-0625a17ead17?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/e294dbc7-a1e5-4b6b-82ca-0625a17ead17?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e294dbc7-a1e5-4b6b-82ca-0625a17ead17?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/e294dbc7-a1e5-4b6b-82ca-0625a17ead17?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e294dbc7-a1e5-4b6b-82ca-0625a17ead17?feedback_type=other)</sup>&nbsp;&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-official-plugins/issues/1949)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#757