[Bug] The functionality for querying and setting the system default model is broken. #20589

Closed
opened 2026-02-21 20:08:04 -05:00 by yindo · 1 comment
Owner

Originally created by @IthacaDream on GitHub (Nov 26, 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.10.1

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Image

✔️ Expected Behavior

The functionality for querying and setting the system default model is broken.

  • The query API returned the following error:
{
    "code": "bad_request",
    "message": "Failed to decode JSON object: Input is a zero-length, empty document: line 1 column 1 (char 0)",
    "status": 400
}
  • The following error occurred when setting up:
{
    "code": "invalid_param",
    "message": "4 validation errors for ParserPostDefault\nmodel_settings.1.model\n  Field required [type=missing, input_value={'model_type': 'text-embedding'}, input_type=dict]\n    For further information visit https:\/\/errors.pydantic.dev\/2.11\/v\/missing\nmodel_settings.2.model\n  Field required [type=missing, input_value={'model_type': 'rerank'}, input_type=dict]\n    For further information visit https:\/\/errors.pydantic.dev\/2.11\/v\/missing\nmodel_settings.3.model\n  Field required [type=missing, input_value={'model_type': 'speech2text'}, input_type=dict]\n    For further information visit https:\/\/errors.pydantic.dev\/2.11\/v\/missing\nmodel_settings.4.model\n  Field required [type=missing, input_value={'model_type': 'tts'}, input_type=dict]\n    For further information visit https:\/\/errors.pydantic.dev\/2.11\/v\/missing",
    "status": 400
}

Actual Behavior

No response

Originally created by @IthacaDream on GitHub (Nov 26, 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.10.1 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce <img width="650" height="366" alt="Image" src="https://github.com/user-attachments/assets/470b2c28-64af-4fbc-8c98-600da8b34909" /> ### ✔️ Expected Behavior ### The functionality for querying and setting the system default model is broken. - The query API returned the following error: ``` { "code": "bad_request", "message": "Failed to decode JSON object: Input is a zero-length, empty document: line 1 column 1 (char 0)", "status": 400 } ``` - The following error occurred when setting up: ``` { "code": "invalid_param", "message": "4 validation errors for ParserPostDefault\nmodel_settings.1.model\n Field required [type=missing, input_value={'model_type': 'text-embedding'}, input_type=dict]\n For further information visit https:\/\/errors.pydantic.dev\/2.11\/v\/missing\nmodel_settings.2.model\n Field required [type=missing, input_value={'model_type': 'rerank'}, input_type=dict]\n For further information visit https:\/\/errors.pydantic.dev\/2.11\/v\/missing\nmodel_settings.3.model\n Field required [type=missing, input_value={'model_type': 'speech2text'}, input_type=dict]\n For further information visit https:\/\/errors.pydantic.dev\/2.11\/v\/missing\nmodel_settings.4.model\n Field required [type=missing, input_value={'model_type': 'tts'}, input_type=dict]\n For further information visit https:\/\/errors.pydantic.dev\/2.11\/v\/missing", "status": 400 } ``` ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 20:08:04 -05:00
yindo closed this issue 2026-02-21 20:08:04 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 26, 2025):

The root cause of the errors is that the API for setting the system default model requires each entry in the model_settings array to include both a model_type and a model string. The validation errors you’re seeing happen when the payload is missing the model field for types like text-embedding, rerank, speech2text, and tts. The JSON decoding error on querying is likely because the GET endpoint expects a model_type query parameter, but the request is missing it or sending an empty body, which the backend tries to parse as JSON and fails reference.

To fix the POST error, make sure your payload looks like this:

{
  "model_settings": [
    {
      "model_type": "reasoning",
      "provider": "openai",
      "model": "gpt-3.5-turbo"
    },
    {
      "model_type": "text-embedding",
      "provider": "openai",
      "model": "text-embedding-ada-002"
    },
    {
      "model_type": "rerank",
      "provider": "openai",
      "model": "rerank-model-name"
    },
    {
      "model_type": "speech2text",
      "provider": "openai",
      "model": "whisper-1"
    },
    {
      "model_type": "tts",
      "provider": "openai",
      "model": "tts-model-name"
    }
  ]
}

Replace the provider and model values with those available in your Dify instance. All fields are required except provider, which can be null if not used.

For the GET error, always include the model_type as a query parameter, like:
GET /api/workspaces/current/default-model?model_type=reasoning

If the UI doesn’t let you fill all required fields, you can use the API directly as a workaround. The official documentation on setting the default model has more details.

There are no recent fixes for this in the codebase, so if the UI/backend mismatch persists, manual API calls are the best workaround for now.

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 (Nov 26, 2025): <!-- Answer --> The root cause of the errors is that the API for setting the system default model requires each entry in the model_settings array to include both a model_type and a model string. The validation errors you’re seeing happen when the payload is missing the model field for types like text-embedding, rerank, speech2text, and tts. The JSON decoding error on querying is likely because the GET endpoint expects a model_type query parameter, but the request is missing it or sending an empty body, which the backend tries to parse as JSON and fails [reference](https://github.com/langgenius/dify/blob/0fdb4e7c12330216fbcbf674815c795f3a97d9e7/api/controllers/console/workspace/models.py#L22-L199). To fix the POST error, make sure your payload looks like this: ```json { "model_settings": [ { "model_type": "reasoning", "provider": "openai", "model": "gpt-3.5-turbo" }, { "model_type": "text-embedding", "provider": "openai", "model": "text-embedding-ada-002" }, { "model_type": "rerank", "provider": "openai", "model": "rerank-model-name" }, { "model_type": "speech2text", "provider": "openai", "model": "whisper-1" }, { "model_type": "tts", "provider": "openai", "model": "tts-model-name" } ] } ``` Replace the provider and model values with those available in your Dify instance. All fields are required except provider, which can be null if not used. For the GET error, always include the model_type as a query parameter, like: `GET /api/workspaces/current/default-model?model_type=reasoning` If the UI doesn’t let you fill all required fields, you can use the API directly as a workaround. The official documentation on [setting the default model](https://docs.dify.ai/en/guides/model-configuration/readme#setting-the-default-model) has more details. There are no recent fixes for this in the codebase, so if the UI/backend mismatch persists, manual API calls are the best workaround for now. <!-- 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/dd6eb5b8-2548-47b1-af2e-04cffdd01721?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/dd6eb5b8-2548-47b1-af2e-04cffdd01721?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/dd6eb5b8-2548-47b1-af2e-04cffdd01721?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/dd6eb5b8-2548-47b1-af2e-04cffdd01721?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/dd6eb5b8-2548-47b1-af2e-04cffdd01721?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/dd6eb5b8-2548-47b1-af2e-04cffdd01721?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/dd6eb5b8-2548-47b1-af2e-04cffdd01721?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=The%20root%20cause%20of%20the%20errors%20is%20that%20the%20API%20for%20setting%20the%20system%20default%20model%20requires%20each%20entry%20in%20the%20model_settings%20array%20to%20include%20both%20a%20model_type%20and%20a%20model%20string.%20The%20validation%20errors%20you%E2%80%99re%20seeing%20happen%20when%20the%20payload%20is%20missing%20the%20model%20field%20for%20types%20like%20text-embedding%2C%20rerank%2C%20speech2text%2C%20and%20tts.%20The%20JSON%20decoding%20error%20on%20querying%20is%20likely%20because%20the%20GET%20endpoint%20expects%20a%20model_type%20query%20parameter%2C%20but%20the%20request%20is%20missing%20it%20or%20sending%20an%20empty%20body%2C%20which%20the%20backend%20tries%20to%20parse%20as%20JSON%20and%20fails%C2%A0%5Breference%5D%28https%3A//github.com/langgenius/dify/blob/0fdb4e7c12330216fbcbf674815c795f3a97d9e7/api/controllers/console/workspace/models.py%23L22-L199%29.%0A%0ATo%20fix%20the%20POST%20error%2C%20make%20sure%20your%20payload%20looks%20like%20this%3A%0A%0A%60%60%60json%0A%7B%0A%20%20%22model_settings%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22model_type%22%3A%20%22reasoning%22%2C%0A%20%20%20%20%20%20%22provider%22%3A%20%22openai%22%2C%0A%20%20%20%20%20%20%22model%22%3A%20%22gpt-3.5-turbo%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22model_type%22%3A%20%22text-embedding%22%2C%0A%20%20%20%20%20%20%22provider%22%3A%20%22openai%22%2C%0A%20%20%20%20%20%20%22model%22%3A%20%22text-embedding-ada-002%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22model_type%22%3A%20%22rerank%22%2C%0A%20%20%20%20%20%20%22provider%22%3A%20%22openai%22%2C%0A%20%20%20%20%20%20%22model%22%3A%20%22rerank-model-name%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22model_type%22%3A%20%22speech2text%22%2C%0A%20%20%20%20%20%20%22provider%22%3A%20%22openai%22%2C%0A%20%20%20%20%20%20%22model%22%3A%20%22whisper-1%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22model_type%22%3A%20%22tts%22%2C%0A%20%20%20%20%20%20%22provider%22%3A%20%22openai%22%2C%0A%20%20%20%20%20%20%22model%22%3A%20%22tts-model-name%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D%0A%60%60%60%0A%0AReplace%20the%20provider%20and%20model%20values%20with%20those%20available%20in%20your%20Dify%20instance.%20All%20fields%20are%20required%20except%20provider%2C%20which%20can%20be%20null%20if%20not%20used.%0A%0AFor%20the%20GET%20error%2C%20always%20include%20the%20model_type%20as%20a%20query%20parameter%2C%20like%3A%20%20%0A%60GET%20/api/workspaces/current/default-model%3Fmodel_type%3Dreasoning%60%0A%0AIf%20the%20UI%20doesn%E2%80%99t%20let%20you%20fill%20all%20required%20fields%2C%20you%20can%20use%20the%20API%20directly%20as%20a%20workaround.%20The%20official%20documentation%20on%20%5Bsetting%20the%20default%20model%5D%28https%3A//docs.dify.ai/en/guides/model-configuration/readme%23setting-the-default-model%29%20has%20more%20details.%0A%0AThere%20are%20no%20recent%20fixes%20for%20this%20in%20the%20codebase%2C%20so%20if%20the%20UI/backend%20mismatch%20persists%2C%20manual%20API%20calls%20are%20the%20best%20workaround%20for%20now.)&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/28742)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20589