Agent Instructions field JSON parser consistently fails at character 79-82 regardless of content #22006

Open
opened 2026-02-21 20:15:14 -05:00 by yindo · 1 comment
Owner

Originally created by @neurofrogger on GitHub (Feb 1, 2026).

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

Version1.11.4

Cloud or Self Hosted

Cloud

Steps to reproduce

ISSUE SUMMARY:
The Agent Instructions field in the Orchestrate configuration consistently fails to save with a JSON parsing error, regardless of content length or format.

ERROR MESSAGE:
"Extra data: line 1 column 80/81/82 (char 79/80/81)"

REPRODUCTION STEPS:

  1. Open any Agent in Studio
  2. Click Agent Settings
  3. Scroll to Orchestrate > Instructions field
  4. Paste any text (tested with 1,280 chars, 3,729 chars, and 10,950 chars)
  5. Click Publish
  6. Error appears

TESTED WITH:

  • Plain text instructions (no markdown, no special characters)
  • Minimal 1,280 character version
  • Full 10,950 character version

✔️ Expected Behavior

EXPECTED BEHAVIOR:
Instructions field should save successfully without JSON parse errors.

Actual Behavior

ACTUAL BEHAVIOR:
Backend consistently returns JSON parse error at character position 79-82, suggesting a systematic parsing bug in the Instructions field validation, not content-related.

This appears to be a backend issue with how Dify's cloud instance validates and stores the Instructions field value in the JSON payload.

Originally created by @neurofrogger on GitHub (Feb 1, 2026). ### 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 Version1.11.4 ### Cloud or Self Hosted Cloud ### Steps to reproduce ISSUE SUMMARY: The Agent Instructions field in the Orchestrate configuration consistently fails to save with a JSON parsing error, regardless of content length or format. ERROR MESSAGE: "Extra data: line 1 column 80/81/82 (char 79/80/81)" REPRODUCTION STEPS: 1. Open any Agent in Studio 2. Click Agent Settings 3. Scroll to Orchestrate > Instructions field 4. Paste any text (tested with 1,280 chars, 3,729 chars, and 10,950 chars) 5. Click Publish 6. Error appears TESTED WITH: - Plain text instructions (no markdown, no special characters) - Minimal 1,280 character version - Full 10,950 character version ### ✔️ Expected Behavior EXPECTED BEHAVIOR: Instructions field should save successfully without JSON parse errors. ### ❌ Actual Behavior ACTUAL BEHAVIOR: Backend consistently returns JSON parse error at character position 79-82, suggesting a systematic parsing bug in the Instructions field validation, not content-related. This appears to be a backend issue with how Dify's cloud instance validates and stores the Instructions field value in the JSON payload.
yindo added the 🐞 bugcloud labels 2026-02-21 20:15:14 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 1, 2026):

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

This error is caused by how the backend expects and parses the Agent Instructions as part of a JSON object. The backend stores the entire agent configuration—including instructions—in a JSON string field and uses strict parsing with no extra validation or sanitization. If the frontend sends the instructions in an unexpected structure or with unescaped content, the backend's json.loads() will throw an "Extra data" error at the first unexpected character, which matches the error and position you see source.

There is no evidence of a recent fix or workaround for this in the codebase or merged pull requests. The bug is not content-related and is likely due to a mismatch between what the frontend sends and what the backend expects. This issue is confirmed in the cloud version and similar JSON parsing issues have been seen in self-hosted setups as well source.

A practical workaround is to ensure that the instructions and all agent configuration fields are valid JSON and properly escaped before submission. If you control the frontend, double-check that the payload structure matches what the backend expects (a dictionary with keys like enabled, strategy, tools, and prompt). For debugging, enabling backend debug logs may help pinpoint the malformed payload. Defensive validation or error handling around json.loads() in the backend would prevent this class of error, but this is not currently implemented source.

If you need to work around this immediately, try to minimize changes to the instructions field and ensure all content is plain text without embedded JSON or special characters. If you have access to backend code, consider adding type checks or validation before deserialization to catch malformed payloads early.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Feb 1, 2026): <!-- Greeting --> Hi @neurofrogger! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> This error is caused by how the backend expects and parses the Agent Instructions as part of a JSON object. The backend stores the entire agent configuration—including instructions—in a JSON string field and uses strict parsing with no extra validation or sanitization. If the frontend sends the instructions in an unexpected structure or with unescaped content, the backend's json.loads() will throw an "Extra data" error at the first unexpected character, which matches the error and position you see [source](https://github.com/langgenius/dify/blob/7828508b3075bd4adcb6b272d43bd799bf96c8f9/api/models/model.py#L131-L549). There is no evidence of a recent fix or workaround for this in the codebase or merged pull requests. The bug is not content-related and is likely due to a mismatch between what the frontend sends and what the backend expects. This issue is confirmed in the cloud version and similar JSON parsing issues have been seen in self-hosted setups as well [source](https://github.com/langgenius/dify/issues/19349#issuecomment-2859151810). A practical workaround is to ensure that the instructions and all agent configuration fields are valid JSON and properly escaped before submission. If you control the frontend, double-check that the payload structure matches what the backend expects (a dictionary with keys like enabled, strategy, tools, and prompt). For debugging, enabling backend debug logs may help pinpoint the malformed payload. Defensive validation or error handling around json.loads() in the backend would prevent this class of error, but this is not currently implemented [source](https://github.com/langgenius/dify/blob/7828508b3075bd4adcb6b272d43bd799bf96c8f9/api/core/workflow/nodes/agent/agent_node.py#L203-L218). If you need to work around this immediately, try to minimize changes to the instructions field and ensure all content is plain text without embedded JSON or special characters. If you have access to backend code, consider adding type checks or validation before deserialization to catch malformed payloads early. <!-- 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/97170028-4f82-4b33-99b1-5ff04e41f427?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/97170028-4f82-4b33-99b1-5ff04e41f427?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/97170028-4f82-4b33-99b1-5ff04e41f427?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/97170028-4f82-4b33-99b1-5ff04e41f427?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/97170028-4f82-4b33-99b1-5ff04e41f427?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/97170028-4f82-4b33-99b1-5ff04e41f427?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/97170028-4f82-4b33-99b1-5ff04e41f427?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20error%20is%20caused%20by%20how%20the%20backend%20expects%20and%20parses%20the%20Agent%20Instructions%20as%20part%20of%20a%20JSON%20object.%20The%20backend%20stores%20the%20entire%20agent%20configuration%E2%80%94including%20instructions%E2%80%94in%20a%20JSON%20string%20field%20and%20uses%20strict%20parsing%20with%20no%20extra%20validation%20or%20sanitization.%20If%20the%20frontend%20sends%20the%20instructions%20in%20an%20unexpected%20structure%20or%20with%20unescaped%20content%2C%20the%20backend%27s%20json.loads%28%29%20will%20throw%20an%20%22Extra%20data%22%20error%20at%20the%20first%20unexpected%20character%2C%20which%20matches%20the%20error%20and%20position%20you%20see%20%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/7828508b3075bd4adcb6b272d43bd799bf96c8f9/api/models/model.py%23L131-L549%29.%0A%0AThere%20is%20no%20evidence%20of%20a%20recent%20fix%20or%20workaround%20for%20this%20in%20the%20codebase%20or%20merged%20pull%20requests.%20The%20bug%20is%20not%20content-related%20and%20is%20likely%20due%20to%20a%20mismatch%20between%20what%20the%20frontend%20sends%20and%20what%20the%20backend%20expects.%20This%20issue%20is%20confirmed%20in%20the%20cloud%20version%20and%20similar%20JSON%20parsing%20issues%20have%20been%20seen%20in%20self-hosted%20setups%20as%20well%20%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/19349%23issuecomment-2859151810%29.%0A%0AA%20practical%20workaround%20is%20to%20ensure%20that%20the%20instructions%20and%20all%20agent%20configuration%20fields%20are%20valid%20JSON%20and%20properly%20escaped%20before%20submission.%20If%20you%20control%20the%20frontend%2C%20double-check%20that%20the%20payload%20structure%20matches%20what%20the%20backend%20expects%20%28a%20dictionary%20with%20keys%20like%20enabled%2C%20strategy%2C%20tools%2C%20and%20prompt%29.%20For%20debugging%2C%20enabling%20backend%20debug%20logs%20may%20help%20pinpoint%20the%20malformed%20payload.%20Defensive%20validation%20or%20error%20handling%20around%20json.loads%28%29%20in%20the%20backend%20would%20prevent%20this%20class%20of%20error%2C%20but%20this%20is%20not%20currently%20implemented%20%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/7828508b3075bd4adcb6b272d43bd799bf96c8f9/api/core/workflow/nodes/agent/agent_node.py%23L203-L218%29.%0A%0AIf%20you%20need%20to%20work%20around%20this%20immediately%2C%20try%20to%20minimize%20changes%20to%20the%20instructions%20field%20and%20ensure%20all%20content%20is%20plain%20text%20without%20embedded%20JSON%20or%20special%20characters.%20If%20you%20have%20access%20to%20backend%20code%2C%20consider%20adding%20type%20checks%20or%20validation%20before%20deserialization%20to%20catch%20malformed%20payloads%20early.)&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/31797)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#22006