JSON input field with schema breaks requests #21935

Open
opened 2026-02-21 20:14:54 -05:00 by yindo · 2 comments
Owner

Originally created by @ciriatico-sol on GitHub (Jan 27, 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

1.11.4

Cloud or Self Hosted

Cloud

Steps to reproduce

Create a workflow or chatflow with a JSON input field;
Specify a schema;
Send a request.

✔️ Expected Behavior

Setting up a schema for a JSON input field and being able to access its values.

Actual Behavior

Setting up a JSON input field with a schema breaks up the requests with a Pydantic error: "1 validation error for VariableEntity json_schema Input should be a valid dictionary [type=dict_type, input_value='{\n "type": "object",\n... "test_count"\n ]\n}', input_type=str] For further information visit https://errors.pydantic.dev/2.11/v/dict_type".
Even simple schemas end up with broken requests. After removing the schema, the chatflow still breaks with the schema error (which only gets suppressed after deleting and recreating the field).
The problem might be related to a badly specified schema, but in the documentation there is no example.
Even a simple schema like this:
{
"type": "object",
"properties": {
"test_message": {
"type": "string"
},
"test_count": {
"type": "integer"
}
},
"required": [
"test_message",
"test_count"
]
}
Breaks if I try to send a request with the input:
{
"test_message": "Hello Dify",
"test_count": 42
}

Image
Originally created by @ciriatico-sol on GitHub (Jan 27, 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 1.11.4 ### Cloud or Self Hosted Cloud ### Steps to reproduce Create a workflow or chatflow with a JSON input field; Specify a schema; Send a request. ### ✔️ Expected Behavior Setting up a schema for a JSON input field and being able to access its values. ### ❌ Actual Behavior Setting up a JSON input field with a schema breaks up the requests with a Pydantic error: "1 validation error for VariableEntity json_schema Input should be a valid dictionary [type=dict_type, input_value='{\n "type": "object",\n... "test_count"\n ]\n}', input_type=str] For further information visit https://errors.pydantic.dev/2.11/v/dict_type". Even simple schemas end up with broken requests. After removing the schema, the chatflow still breaks with the schema error (which only gets suppressed after deleting and recreating the field). The problem might be related to a badly specified schema, but in the documentation there is no example. Even a simple schema like this: { "type": "object", "properties": { "test_message": { "type": "string" }, "test_count": { "type": "integer" } }, "required": [ "test_message", "test_count" ] } Breaks if I try to send a request with the input: { "test_message": "Hello Dify", "test_count": 42 } <img width="480" height="270" alt="Image" src="https://github.com/user-attachments/assets/d321a01d-3d6f-44a0-9a4a-508c717f0986" />
yindo added the 🐞 bug label 2026-02-21 20:14:54 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 27, 2026):

This is a known bug in Dify v1.11.4: when you specify a JSON schema for a JSON input field, the backend expects the schema as a Python dictionary, but the UI or API may send it as a JSON string. This type mismatch triggers the Pydantic validation error you’re seeing (“Input should be a valid dictionary [type=dict_type, input_value=... input_type=str]”)—even with simple schemas and matching input values. Removing the schema from the field doesn’t always clear the error because the invalid schema can persist in the backend; only deleting and recreating the field reliably resets it. There are no official documentation examples for this feature in v1.11.4, which makes it easy to run into this problem.

This was fixed in later versions: both the schema and the input value must be dictionaries (not strings) throughout the stack, and removing a schema now properly clears it from the backend, preventing stale validation errors. For v1.11.4, the only workaround is to delete and recreate the affected field if you get stuck in a broken state. If you upgrade, make sure to provide schemas and input values as dicts, not JSON strings, to avoid this issue in the future.
See details and code changes

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 (Jan 27, 2026): <!-- Answer --> This is a known bug in Dify v1.11.4: when you specify a JSON schema for a JSON input field, the backend expects the schema as a Python dictionary, but the UI or API may send it as a JSON string. This type mismatch triggers the Pydantic validation error you’re seeing (“Input should be a valid dictionary [type=dict_type, input_value=... input_type=str]”)—even with simple schemas and matching input values. Removing the schema from the field doesn’t always clear the error because the invalid schema can persist in the backend; only deleting and recreating the field reliably resets it. There are no official documentation examples for this feature in v1.11.4, which makes it easy to run into this problem. This was fixed in later versions: both the schema and the input value must be dictionaries (not strings) throughout the stack, and removing a schema now properly clears it from the backend, preventing stale validation errors. For v1.11.4, the only workaround is to delete and recreate the affected field if you get stuck in a broken state. If you upgrade, make sure to provide schemas and input values as dicts, not JSON strings, to avoid this issue in the future. [See details and code changes](https://github.com/langgenius/dify/pull/30732) <!-- 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/816fd469-58fd-4ee2-8606-90ae0f9f578c?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/816fd469-58fd-4ee2-8606-90ae0f9f578c?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/816fd469-58fd-4ee2-8606-90ae0f9f578c?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/816fd469-58fd-4ee2-8606-90ae0f9f578c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/816fd469-58fd-4ee2-8606-90ae0f9f578c?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/816fd469-58fd-4ee2-8606-90ae0f9f578c?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/816fd469-58fd-4ee2-8606-90ae0f9f578c?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%20is%20a%20known%20bug%20in%20Dify%20v1.11.4%3A%20when%20you%20specify%20a%20JSON%20schema%20for%20a%20JSON%20input%20field%2C%20the%20backend%20expects%20the%20schema%20as%20a%20Python%20dictionary%2C%20but%20the%20UI%20or%20API%20may%20send%20it%20as%20a%20JSON%20string.%20This%20type%20mismatch%20triggers%20the%20Pydantic%20validation%20error%20you%E2%80%99re%20seeing%20%28%E2%80%9CInput%20should%20be%20a%20valid%20dictionary%20%5Btype%3Ddict_type%2C%20input_value%3D...%20input_type%3Dstr%5D%E2%80%9D%29%E2%80%94even%20with%20simple%20schemas%20and%20matching%20input%20values.%20Removing%20the%20schema%20from%20the%20field%20doesn%E2%80%99t%20always%20clear%20the%20error%20because%20the%20invalid%20schema%20can%20persist%20in%20the%20backend%3B%20only%20deleting%20and%20recreating%20the%20field%20reliably%20resets%20it.%20There%20are%20no%20official%20documentation%20examples%20for%20this%20feature%20in%20v1.11.4%2C%20which%20makes%20it%20easy%20to%20run%20into%20this%20problem.%0A%0AThis%20was%20fixed%20in%20later%20versions%3A%20both%20the%20schema%20and%20the%20input%20value%20must%20be%20dictionaries%20%28not%20strings%29%20throughout%20the%20stack%2C%20and%20removing%20a%20schema%20now%20properly%20clears%20it%20from%20the%20backend%2C%20preventing%20stale%20validation%20errors.%20For%20v1.11.4%2C%20the%20only%20workaround%20is%20to%20delete%20and%20recreate%20the%20affected%20field%20if%20you%20get%20stuck%20in%20a%20broken%20state.%20If%20you%20upgrade%2C%20make%20sure%20to%20provide%20schemas%20and%20input%20values%20as%20dicts%2C%20not%20JSON%20strings%2C%20to%20avoid%20this%20issue%20in%20the%20future.%20%20%0A%5BSee%20details%20and%20code%20changes%5D%28https%3A//github.com/langgenius/dify/pull/30732%29)&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/31621)
Author
Owner

@PrinOrange commented on GitHub (Jan 29, 2026):

Same here.
My json schema is:

{
  "type": "object",
  "properties": {
    "sample": {
      "type": "string"
    },
    "phenomenon": {
      "type": "string"
    },
    "design": {
      "type": "string"
    },
    "evaluation": {
      "type": "string"
    },
    "research_type": {
      "type": "string"
    }
  },
  "required": [
    "sample",
    "phenomenon",
    "design",
    "evaluation",
    "research_type"
  ],
  "additionalProperties": false
}

And it reports the error:

1 validation error for VariableEntity json_schema Input should be a valid dictionary [type=dict_type, input_value='{\n "type": "object",\n...alProperties": false\n}', input_type=str] For further information visit https://errors.pydantic.dev/2.11/v/dict_type
@PrinOrange commented on GitHub (Jan 29, 2026): Same here. My json schema is: ``` { "type": "object", "properties": { "sample": { "type": "string" }, "phenomenon": { "type": "string" }, "design": { "type": "string" }, "evaluation": { "type": "string" }, "research_type": { "type": "string" } }, "required": [ "sample", "phenomenon", "design", "evaluation", "research_type" ], "additionalProperties": false } ``` And it reports the error: ``` 1 validation error for VariableEntity json_schema Input should be a valid dictionary [type=dict_type, input_value='{\n "type": "object",\n...alProperties": false\n}', input_type=str] For further information visit https://errors.pydantic.dev/2.11/v/dict_type ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21935