Issue with Content-Type for Audio Upload in Version 1.4.2 (The issue remains unresolved from version 1.3.0 to this version) #14594

Closed
opened 2026-02-21 19:17:57 -05:00 by yindo · 2 comments
Owner

Originally created by @momopia on GitHub (Jun 12, 2025).

Originally assigned to: @crazywoola on GitHub.

Self Checks

  • 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 (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.4.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

THIS IT THE SECOND TIME WE REPORT THIS BUG,AND IS THERE ANYONE WHO CAN SOLVE THIS BUG PLEASE?

Issue with Content-Type for Audio Upload
In the previous version of our application, we were able to successfully upload audio files for transcription by setting the Content-Type to multipart/form-data. However, with the recent update to version 1.3.0(untill newest version 1.4.2), we encountered an issue where the Content-Type must be set to audio/mp3 in order to send the audio files. If we attempt to use any other Content-Type(such as multipart/form-data,with a mp3 file upload), we receive the following error response:
JSON复制
{
"code": "unsupported_audio_type",
"message": "Audio type not allowed.",
"status": 415
}
This change is causing a significant problem for us because we are integrating the speech-to-text functionality into a WeChat Mini Program. Unfortunately, WeChat Mini Programs have strict limitations on the Content-Type values that can be used in network requests. Specifically, the only allowed values are:
multipart/form-data (for file uploads)
application/json (for JSON data)
application/octet-stream (for binary data streams)
Given these constraints, we are unable to set the Content-Type to audio/mp3, which is now required by version 1.3.0 of our application. As a result, we are unable to use the speech-to-text functionality within the WeChat Mini Program.
Request for Assistance: We kindly ask for your help in resolving this issue. Is there a way to configure the API to accept multipart/form-data or application/octet-stream for audio uploads, similar to the previous version? Alternatively, if there is a workaround or an alternative approach that we can use within the constraints of WeChat Mini Programs, we would greatly appreciate your guidance.
Thank you for your attention to this matter. We look forward to your response.

✔️ Expected Behavior

Expected Result:
The API should accept audio uploads with the Content-Type set to multipart/form-data or application/octet-stream, similar to the previous version of the application. This would allow the speech-to-text functionality to work within the constraints of WeChat Mini Programs.

Actual Behavior

Current Result:
The API in version 1.3.0 only accepts audio uploads with the Content-Type set to audio/mp3. Any other Content-Type, including multipart/form-data or application/octet-stream, results in an error response with the code "unsupported_audio_type" and the message "Audio type not allowed." This is problematic because Tencent's WeChat Mini Programs only support the following Content-Type values for network requests:
multipart/form-data (for file uploads)
application/json (for JSON data)
application/octet-stream (for binary data streams)

Originally created by @momopia on GitHub (Jun 12, 2025). Originally assigned to: @crazywoola on GitHub. ### Self Checks - [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 (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.4.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce THIS IT THE SECOND TIME WE REPORT THIS BUG,AND IS THERE ANYONE WHO CAN SOLVE THIS BUG PLEASE? Issue with Content-Type for Audio Upload In the previous version of our application, we were able to successfully upload audio files for transcription by setting the Content-Type to multipart/form-data. However, with the recent update to version 1.3.0(untill newest version 1.4.2), we encountered an issue where the Content-Type must be set to audio/mp3 in order to send the audio files. If we attempt to use any other Content-Type(such as multipart/form-data,with a mp3 file upload), we receive the following error response: JSON复制 { "code": "unsupported_audio_type", "message": "Audio type not allowed.", "status": 415 } This change is causing a significant problem for us because we are integrating the speech-to-text functionality into a WeChat Mini Program. Unfortunately, WeChat Mini Programs have strict limitations on the Content-Type values that can be used in network requests. Specifically, the only allowed values are: multipart/form-data (for file uploads) application/json (for JSON data) application/octet-stream (for binary data streams) Given these constraints, we are unable to set the Content-Type to audio/mp3, which is now required by version 1.3.0 of our application. As a result, we are unable to use the speech-to-text functionality within the WeChat Mini Program. Request for Assistance: We kindly ask for your help in resolving this issue. Is there a way to configure the API to accept multipart/form-data or application/octet-stream for audio uploads, similar to the previous version? Alternatively, if there is a workaround or an alternative approach that we can use within the constraints of WeChat Mini Programs, we would greatly appreciate your guidance. Thank you for your attention to this matter. We look forward to your response. ### ✔️ Expected Behavior Expected Result: The API should accept audio uploads with the Content-Type set to multipart/form-data or application/octet-stream, similar to the previous version of the application. This would allow the speech-to-text functionality to work within the constraints of WeChat Mini Programs. ### ❌ Actual Behavior Current Result: The API in version 1.3.0 only accepts audio uploads with the Content-Type set to audio/mp3. Any other Content-Type, including multipart/form-data or application/octet-stream, results in an error response with the code "unsupported_audio_type" and the message "Audio type not allowed." This is problematic because Tencent's WeChat Mini Programs only support the following Content-Type values for network requests: multipart/form-data (for file uploads) application/json (for JSON data) application/octet-stream (for binary data streams)
yindo added the 🐞 bugstt & tts labels 2026-02-21 19:17:57 -05:00
yindo closed this issue 2026-02-21 19:17:58 -05:00
Author
Owner

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

This issue is caused by strict MIME type checks in the backend: Dify only accepts audio uploads where the file part’s Content-Type is one of the allowed audio types (like audio/mp3, audio/m4a, etc.), and it rejects uploads with generic types like application/octet-stream—even if the file is valid audio. There is currently no configuration or environment setting to change this; the restriction is enforced directly in the code (AudioApi, AudioService).

To support WeChat Mini Programs, you would need to modify the backend to accept multipart/form-data or application/octet-stream and relax the per-file Content-Type validation. This means updating the controller and service logic to either (a) accept these generic types and then inspect the file content to determine if it’s a supported audio format, or (b) bypass the strict Content-Type check for uploads from trusted sources.

There are no workarounds or configuration flags for this in current Dify releases. If you cannot modify the backend, a possible workaround is to use a proxy server that rewrites the Content-Type header to an accepted value before forwarding the request to Dify.

If you need guidance on what to change in the code, let me know!

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jun 12, 2025): <!-- Answer --> This issue is caused by strict MIME type checks in the backend: Dify only accepts audio uploads where the file part’s Content-Type is one of the allowed audio types (like audio/mp3, audio/m4a, etc.), and it rejects uploads with generic types like application/octet-stream—even if the file is valid audio. There is currently no configuration or environment setting to change this; the restriction is enforced directly in the code ([AudioApi](https://github.com/langgenius/dify/blob/c05e47ebc0017caba71f1787a10523a96070a53f/api/controllers/service_api/app/audio.py), [AudioService](https://github.com/langgenius/dify/blob/c05e47ebc0017caba71f1787a10523a96070a53f/api/services/audio_service.py)). To support WeChat Mini Programs, you would need to modify the backend to accept multipart/form-data or application/octet-stream and relax the per-file Content-Type validation. This means updating the controller and service logic to either (a) accept these generic types and then inspect the file content to determine if it’s a supported audio format, or (b) bypass the strict Content-Type check for uploads from trusted sources. There are no workarounds or configuration flags for this in current Dify releases. If you cannot modify the backend, a possible workaround is to use a proxy server that rewrites the Content-Type header to an accepted value before forwarding the request to Dify. If you need guidance on what to change in the code, let me know! <!-- 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/8d31982b-919c-4106-bd89-5e26bdda6634?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/8d31982b-919c-4106-bd89-5e26bdda6634?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/8d31982b-919c-4106-bd89-5e26bdda6634?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/8d31982b-919c-4106-bd89-5e26bdda6634?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8d31982b-919c-4106-bd89-5e26bdda6634?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/8d31982b-919c-4106-bd89-5e26bdda6634?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8d31982b-919c-4106-bd89-5e26bdda6634?feedback_type=other)</sup>&nbsp;&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/20978)
Author
Owner

@StephentTom commented on GitHub (Dec 11, 2025):

@momopia 到现在 1.10.1 版本有解决出现({"code":415,"errorMsg":"Unsupported Media Type","data":{"code":"unsupported_audio_type","message":"Audio type not allowed.","status":415}})问题的解决方式吗?

As of version 1.10.1 there is a fix ({"code":415,"errorMsg":"Unsupported Media Type","data":{"code":"unsupported_audio_type","message":"Audio type not allowed.","status":415}}) The solution to the problem?

@StephentTom commented on GitHub (Dec 11, 2025): @momopia 到现在 1.10.1 版本有解决出现({"code":415,"errorMsg":"Unsupported Media Type","data":{"code":"unsupported_audio_type","message":"Audio type not allowed.","status":415}})问题的解决方式吗? As of version 1.10.1 there is a fix ({"code":415,"errorMsg":"Unsupported Media Type","data":{"code":"unsupported_audio_type","message":"Audio type not allowed.","status":415}}) The solution to the problem?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#14594