mime_type is None #21005

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

Originally created by @fatelei on GitHub (Dec 12, 2025).

Originally assigned to: @fatelei on GitHub.

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

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

POST /api/chat-messages

✔️ Expected Behavior

no error

Actual Behavior

mime type is none

Originally created by @fatelei on GitHub (Dec 12, 2025). Originally assigned to: @fatelei on GitHub. ### 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.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce POST [/api/chat-messages](http://udify.app/api/chat-messages) ### ✔️ Expected Behavior no error ### ❌ Actual Behavior mime type is none
yindo added the 🐞 bug label 2026-02-21 20:10:13 -05:00
yindo closed this issue 2026-02-21 20:10:13 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 12, 2025):

The "mime type is none" error usually means the API request is missing a proper Content-Type header, or the file extension is not recognized, so Dify can't determine the MIME type. This is a known issue, especially in self-hosted Docker setups and when uploading files directly via API. Dify relies on the client to set the correct MIME type, typically based on the file extension. If the client doesn't set a recognized Content-Type, or the file extension is uncommon or missing, the backend can't determine the correct type and may pass a generic value like "none" or "other" details.

To fix this, make sure your API request includes Content-Type: application/json for the body, and if you're uploading files, use standard file extensions and set the correct MIME type in your upload tool. If you need more robust detection, you could patch the backend to use a library like python-magic for content-based MIME type detection, but by default, Dify does not do this details.

Recent updates have improved MIME type handling, including better validation and fallbacks see PR #28843. If you're running into this with HTTP 204 No Content responses, there's a known bug where Dify expects a Content-Type header even when there shouldn't be one. You can patch your deployment by adding a check for response.status_code == 204 before the content-type logic in api/core/mcp/client/streamable_client.py fix instructions.

If you're still stuck, check your backend logs for more details and confirm your request payload matches the expected format. If you want to see exactly how the endpoint handles requests and responses, you can review the implementation in completion.py and helper.py.

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 (Dec 12, 2025): <!-- Answer --> The "mime type is none" error usually means the API request is missing a proper `Content-Type` header, or the file extension is not recognized, so Dify can't determine the MIME type. This is a known issue, especially in self-hosted Docker setups and when uploading files directly via API. Dify relies on the client to set the correct MIME type, typically based on the file extension. If the client doesn't set a recognized `Content-Type`, or the file extension is uncommon or missing, the backend can't determine the correct type and may pass a generic value like "none" or "other" [details](https://github.com/langgenius/dify/issues/23158). To fix this, make sure your API request includes `Content-Type: application/json` for the body, and if you're uploading files, use standard file extensions and set the correct MIME type in your upload tool. If you need more robust detection, you could patch the backend to use a library like `python-magic` for content-based MIME type detection, but by default, Dify does not do this [details](https://github.com/langgenius/dify/issues/19083). Recent updates have improved MIME type handling, including better validation and fallbacks [see PR #28843](https://github.com/langgenius/dify/pull/28843). If you're running into this with HTTP 204 No Content responses, there's a known bug where Dify expects a `Content-Type` header even when there shouldn't be one. You can patch your deployment by adding a check for `response.status_code == 204` before the content-type logic in `api/core/mcp/client/streamable_client.py` [fix instructions](https://github.com/langgenius/dify/issues/24962). If you're still stuck, check your backend logs for more details and confirm your request payload matches the expected format. If you want to see exactly how the endpoint handles requests and responses, you can review the implementation in [completion.py](https://github.com/langgenius/dify/blob/336bcfbae262369aef92c12d75a0bfbc2de8539e/api/controllers/service_api/app/completion.py) and [helper.py](https://github.com/langgenius/dify/blob/336bcfbae262369aef92c12d75a0bfbc2de8539e/api/libs/helper.py). <!-- 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/53bec680-fe0c-4255-b411-21f0f2f692a1?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/53bec680-fe0c-4255-b411-21f0f2f692a1?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/53bec680-fe0c-4255-b411-21f0f2f692a1?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/53bec680-fe0c-4255-b411-21f0f2f692a1?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/53bec680-fe0c-4255-b411-21f0f2f692a1?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/53bec680-fe0c-4255-b411-21f0f2f692a1?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/53bec680-fe0c-4255-b411-21f0f2f692a1?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%20%22mime%20type%20is%20none%22%20error%20usually%20means%20the%20API%20request%20is%20missing%20a%20proper%20%60Content-Type%60%20header%2C%20or%20the%20file%20extension%20is%20not%20recognized%2C%20so%20Dify%20can%27t%20determine%20the%20MIME%20type.%20This%20is%20a%20known%20issue%2C%20especially%20in%20self-hosted%20Docker%20setups%20and%20when%20uploading%20files%20directly%20via%20API.%20Dify%20relies%20on%20the%20client%20to%20set%20the%20correct%20MIME%20type%2C%20typically%20based%20on%20the%20file%20extension.%20If%20the%20client%20doesn%27t%20set%20a%20recognized%20%60Content-Type%60%2C%20or%20the%20file%20extension%20is%20uncommon%20or%20missing%2C%20the%20backend%20can%27t%20determine%20the%20correct%20type%20and%20may%20pass%20a%20generic%20value%20like%20%22none%22%20or%20%22other%22%C2%A0%5Bdetails%5D%28https%3A//github.com/langgenius/dify/issues/23158%29.%0A%0ATo%20fix%20this%2C%20make%20sure%20your%20API%20request%20includes%20%60Content-Type%3A%20application/json%60%20for%20the%20body%2C%20and%20if%20you%27re%20uploading%20files%2C%20use%20standard%20file%20extensions%20and%20set%20the%20correct%20MIME%20type%20in%20your%20upload%20tool.%20If%20you%20need%20more%20robust%20detection%2C%20you%20could%20patch%20the%20backend%20to%20use%20a%20library%20like%20%60python-magic%60%20for%20content-based%20MIME%20type%20detection%2C%20but%20by%20default%2C%20Dify%20does%20not%20do%20this%C2%A0%5Bdetails%5D%28https%3A//github.com/langgenius/dify/issues/19083%29.%0A%0ARecent%20updates%20have%20improved%20MIME%20type%20handling%2C%20including%20better%20validation%20and%20fallbacks%C2%A0%5Bsee%20PR%20%2328843%5D%28https%3A//github.com/langgenius/dify/pull/28843%29.%20If%20you%27re%20running%20into%20this%20with%20HTTP%20204%20No%20Content%20responses%2C%20there%27s%20a%20known%20bug%20where%20Dify%20expects%20a%20%60Content-Type%60%20header%20even%20when%20there%20shouldn%27t%20be%20one.%20You%20can%20patch%20your%20deployment%20by%20adding%20a%20check%20for%20%60response.status_code%20%3D%3D%20204%60%20before%20the%20content-type%20logic%20in%20%60api/core/mcp/client/streamable_client.py%60%C2%A0%5Bfix%20instructions%5D%28https%3A//github.com/langgenius/dify/issues/24962%29.%0A%0AIf%20you%27re%20still%20stuck%2C%20check%20your%20backend%20logs%20for%20more%20details%20and%20confirm%20your%20request%20payload%20matches%20the%20expected%20format.%20If%20you%20want%20to%20see%20exactly%20how%20the%20endpoint%20handles%20requests%20and%20responses%2C%20you%20can%20review%20the%20implementation%20in%C2%A0%5Bcompletion.py%5D%28https%3A//github.com/langgenius/dify/blob/336bcfbae262369aef92c12d75a0bfbc2de8539e/api/controllers/service_api/app/completion.py%29%20and%C2%A0%5Bhelper.py%5D%28https%3A//github.com/langgenius/dify/blob/336bcfbae262369aef92c12d75a0bfbc2de8539e/api/libs/helper.py%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/29578)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21005