Skip to content

JSON type input var raise Intenal server error #36766

Closed

Description

@Yanchongyun

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.14.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

worker container

2026-05-28 06:30:47.674 ERROR [Dummy-27552] [trace.py:309] 6c73a6f159f75c679d36f6d5ca17bcb9 - Task tasks.app_generate.workflow_execute_task.workflow_based_app_execution_task[5bd8f6ad-fbfa-4a6f-81f0-69e67fc54d72] raised unexpected: 1 validation error for VariableEntity

json_schema

  Input should be a valid dictionary [type=dict_type, input_value='{\n  "type": "object",\n..."number"\n    }\n  }\n}', input_type=str]

    For further information visit https://errors.pydantic.dev/2.12/v/dict_type

Traceback (most recent call last):

  File "/app/api/.venv/lib/python3.12/site-packages/celery/app/trace.py", line 585, in trace_task

    R = retval = fun(*args, **kwargs)

                 ^^^^^^^^^^^^^^^^^^^^

  File "/app/api/extensions/ext_celery.py", line 101, in __call__

    return self.run(*args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/api/tasks/app_generate/workflow_execute_task.py", line 269, in workflow_based_app_execution_task

    return runner.run()

           ^^^^^^^^^^^^

  File "/app/api/tasks/app_generate/workflow_execute_task.py", line 165, in run

    response = self._run_app(

               ^^^^^^^^^^^^^^

  File "/app/api/tasks/app_generate/workflow_execute_task.py", line 187, in _run_app

    return AdvancedChatAppGenerator().generate(

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 172, in generate

    app_config = AdvancedChatAppConfigManager.get_app_config(app_model=app_model, workflow=workflow)

                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/api/core/app/apps/advanced_chat/app_config_manager.py", line 36, in get_app_config

    variables=WorkflowVariablesConfigManager.convert(workflow=workflow),

              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/api/core/app/app_config/workflow_ui_based_app/variables/manager.py", line 23, in convert

    variables.append(VariableEntity.model_validate(variable))

                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/api/.venv/lib/python3.12/site-packages/pydantic/main.py", line 716, in model_validate

    return cls.__pydantic_validator__.validate_python(

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

pydantic_core._pydantic_core.ValidationError: 1 validation error for VariableEntity

json_schema

  Input should be a valid dictionary [type=dict_type, input_value='{\n  "type": "object",\n..."number"\n    }\n  }\n}', input_type=str]

    For further information visit https://errors.pydantic.dev/2.12/v/dict_type

Step:

  1. Init a JSON type input var in Start node and input json schema.
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "age": {
      "type": "number"
    }
  }
}
  1. Input json var value {"name":"abc","age":10} and start chat.

Position:

class WorkflowVariablesConfigManager:
@classmethod
def convert(cls, workflow: Workflow) -> list[VariableEntity]:
"""
Convert workflow start variables to variables
:param workflow: workflow instance
"""
variables = []
# find start node
user_input_form = workflow.user_input_form()
# variables
for variable in user_input_form:
variables.append(VariableEntity.model_validate(variable))
return variables

https://github.com/langgenius/graphon/blob/7c300aec3dad2b420bbe259f48a4c1cde1250f97/src/graphon/variables/input_entities.py#L26-L69

class VariableEntity(BaseModel):
    """Shared variable entity used by workflow runtime and app configuration."""

    # `variable` records the name of the variable in user inputs.
    variable: str
    label: str
    description: str = ""
    type: VariableEntityType
    required: bool = False
    hide: bool = False
    default: Any = None
    max_length: int | None = None
    options: Sequence[str] = Field(default_factory=list)
    allowed_file_types: Sequence[FileType] | None = Field(default_factory=list)
    allowed_file_extensions: Sequence[str] | None = Field(default_factory=list)
    allowed_file_upload_methods: Sequence[FileTransferMethod] | None = Field(
        default_factory=list,
    )
    json_schema: dict[str, Any] | None = Field(default=None)

    @field_validator("description", mode="before")
    @classmethod
    def convert_none_description(cls, value: Any) -> str:
        return value or ""

    @field_validator("options", mode="before")
    @classmethod
    def convert_none_options(cls, value: Any) -> Sequence[str]:
        return value or []

    @field_validator("json_schema")
    @classmethod
    def validate_json_schema(
        cls,
        schema: dict[str, Any] | None,
    ) -> dict[str, Any] | None:
        if schema is None:
            return None
        try:
            Draft7Validator.check_schema(schema)
        except SchemaError as error:
            msg = f"Invalid JSON schema: {error.message}"
            raise ValueError(msg) from error
        return schema

✔️ Expected Behavior

No error raised.

❌ Actual Behavior

Chat will be Blocked.

Activity

  1. changed the title [-]Intenal server error[/-] [+]JSON type input var raise Intenal server error[/+] on May 28, 2026
  2. added
    1.14.0
    on May 29, 2026
  3. added a commit that references this issue on Jun 1, 2026
    5cd166e
  4. added
    🐞 bug
    on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    1.14.0project#dify🐞 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions