use text-embeddings-inference get "413 Payload Too Large" #7471

Closed
opened 2026-02-21 18:20:45 -05:00 by yindo · 8 comments
Owner

Originally created by @momomobinx on GitHub (Dec 31, 2024).

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

0.14.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Use text-embeddings-inference for embedding service, but its single request context size is limited to 2MB. When the document uploaded to the knowledge base is larger than 2MB, this error will be encountered

Notes under text-embeddings-inference

✔️ Expected Behavior

Normally handle large files

Actual Behavior

Error when processing large files

Originally created by @momomobinx on GitHub (Dec 31, 2024). ### 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 0.14.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Use text-embeddings-inference for embedding service, but its single request context size is limited to 2MB. When the document uploaded to the knowledge base is larger than 2MB, this error will be encountered [Notes under text-embeddings-inference](https://github.com/huggingface/text-embeddings-inference/issues/50#issuecomment-1960067680) ### ✔️ Expected Behavior Normally handle large files ### ❌ Actual Behavior Error when processing large files
yindo added the good first issue👻 feat:rag labels 2026-02-21 18:20:45 -05:00
yindo closed this issue 2026-02-21 18:20:45 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 31, 2024):

I found a similar open issue regarding the "413 Payload Too Large" error when uploading large files in Dify. The suggested solution involves ensuring that both the UPLOAD_FILE_SIZE_LIMIT environment variable and the client_max_body_size parameter in the Nginx configuration are set correctly. Here are the steps to resolve the issue:

  1. Check UPLOAD_FILE_SIZE_LIMIT: Ensure that the UPLOAD_FILE_SIZE_LIMIT in your Dify configuration is set to a value larger than the file you are trying to upload.

  2. Update Nginx Configuration: Modify the client_max_body_size parameter in the Nginx configuration to match the desired upload limit. This can be done by setting the NGINX_CLIENT_MAX_BODY_SIZE environment variable in your Docker setup.

    Example:

    NGINX_CLIENT_MAX_BODY_SIZE=50M
    

    Update the docker-compose.yaml file:

    environment:
      NGINX_CLIENT_MAX_BODY_SIZE: ${NGINX_CLIENT_MAX_BODY_SIZE:-50M}
    

    Ensure the Nginx configuration template reflects this change:

    client_max_body_size ${NGINX_CLIENT_MAX_BODY_SIZE};
    
  3. Rebuild and Restart Docker Containers: After making these changes, rebuild and restart your Docker containers:

    docker-compose down
    docker-compose up --build -d
    

These steps should help resolve the "413 Payload Too Large" error and allow you to upload files successfully [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Dec 31, 2024): <!-- Answer --> I found a similar open issue regarding the "413 Payload Too Large" error when uploading large files in Dify. The suggested solution involves ensuring that both the `UPLOAD_FILE_SIZE_LIMIT` environment variable and the `client_max_body_size` parameter in the Nginx configuration are set correctly. Here are the steps to resolve the issue: 1. **Check `UPLOAD_FILE_SIZE_LIMIT`**: Ensure that the `UPLOAD_FILE_SIZE_LIMIT` in your Dify configuration is set to a value larger than the file you are trying to upload. 2. **Update Nginx Configuration**: Modify the `client_max_body_size` parameter in the Nginx configuration to match the desired upload limit. This can be done by setting the `NGINX_CLIENT_MAX_BODY_SIZE` environment variable in your Docker setup. Example: ```env NGINX_CLIENT_MAX_BODY_SIZE=50M ``` Update the `docker-compose.yaml` file: ```yaml environment: NGINX_CLIENT_MAX_BODY_SIZE: ${NGINX_CLIENT_MAX_BODY_SIZE:-50M} ``` Ensure the Nginx configuration template reflects this change: ```nginx client_max_body_size ${NGINX_CLIENT_MAX_BODY_SIZE}; ``` 3. **Rebuild and Restart Docker Containers**: After making these changes, rebuild and restart your Docker containers: ```sh docker-compose down docker-compose up --build -d ``` These steps should help resolve the "413 Payload Too Large" error and allow you to upload files successfully <sup>[[1]](https://github.com/langgenius/dify/discussions/8277)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/9481cfef-3b85-49c2-b92a-57427f8e02e5?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/9481cfef-3b85-49c2-b92a-57427f8e02e5?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/9481cfef-3b85-49c2-b92a-57427f8e02e5?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/9481cfef-3b85-49c2-b92a-57427f8e02e5?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/9481cfef-3b85-49c2-b92a-57427f8e02e5?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/9481cfef-3b85-49c2-b92a-57427f8e02e5?feedback_type=other)</sup>
Author
Owner

@momomobinx commented on GitHub (Dec 31, 2024):

That doesn't seem to be the reason.

@momomobinx commented on GitHub (Dec 31, 2024): That doesn't seem to be the reason.
Author
Owner

@momomobinx commented on GitHub (Dec 31, 2024):

七法全书(V1.1).txt

docker run \
	-d \
	--name embedding \
	--gpus '"device=0"' \
	--env CUDA_VISIBLE_DEVICES=0 \
	-p 7862:80 \
	-v $(pwd):/data \
	ghcr.io/huggingface/text-embeddings-inference:86-1.5 \
	--model-id "/data/gte-small-zh"
@momomobinx commented on GitHub (Dec 31, 2024): [七法全书(V1.1).txt](https://github.com/user-attachments/files/18280136/V1.1.txt) ``` docker run \ -d \ --name embedding \ --gpus '"device=0"' \ --env CUDA_VISIBLE_DEVICES=0 \ -p 7862:80 \ -v $(pwd):/data \ ghcr.io/huggingface/text-embeddings-inference:86-1.5 \ --model-id "/data/gte-small-zh" ```
Author
Owner

@dosubot[bot] commented on GitHub (Feb 1, 2025):

Hi, @momomobinx. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary

  • You reported a "413 Payload Too Large" error with the text-embeddings-inference service in Dify version 0.14.2 using Docker.
  • The error occurs for files larger than 2MB.
  • Suggested solutions included checking UPLOAD_FILE_SIZE_LIMIT and updating client_max_body_size in Nginx, which did not resolve the issue.
  • You provided a Docker command for further diagnosis.

Next Steps

  • Please confirm if this issue is still relevant with the latest version of the Dify repository. If so, you can keep the discussion open by commenting here.
  • If there is no further activity, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Feb 1, 2025): Hi, @momomobinx. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog. I'm marking this issue as stale. **Issue Summary** - You reported a "413 Payload Too Large" error with the text-embeddings-inference service in Dify version 0.14.2 using Docker. - The error occurs for files larger than 2MB. - Suggested solutions included checking `UPLOAD_FILE_SIZE_LIMIT` and updating `client_max_body_size` in Nginx, which did not resolve the issue. - You provided a Docker command for further diagnosis. **Next Steps** - Please confirm if this issue is still relevant with the latest version of the Dify repository. If so, you can keep the discussion open by commenting here. - If there is no further activity, this issue will be automatically closed in 15 days. Thank you for your understanding and contribution!
Author
Owner

@rabbit-joe commented on GitHub (Mar 19, 2025):

这似乎不是原因。

您好 请问这个问题您解决了吗

@rabbit-joe commented on GitHub (Mar 19, 2025): > 这似乎不是原因。 您好 请问这个问题您解决了吗
Author
Owner

@momomobinx commented on GitHub (Mar 19, 2025):

这似乎不是原因。

您好 请问这个问题您解决了吗

我是用open ai 兼容的那个插件接入没有问题,使用TEI的插件有问题

@momomobinx commented on GitHub (Mar 19, 2025): > > 这似乎不是原因。 > > 您好 请问这个问题您解决了吗 我是用open ai 兼容的那个插件接入没有问题,使用TEI的插件有问题
Author
Owner

@rabbit-joe commented on GitHub (Mar 19, 2025):

这似乎不是原因。

您好 请问这个问题您解决了吗

我是用open ai 兼容的那个插件接入没有问题,使用TEI的插件有问题

好像是的 我用open ai兼容的那个插件也没问题 排查半天了 ):

@rabbit-joe commented on GitHub (Mar 19, 2025): > > > 这似乎不是原因。 > > > > > > 您好 请问这个问题您解决了吗 > > 我是用open ai 兼容的那个插件接入没有问题,使用TEI的插件有问题 好像是的 我用open ai兼容的那个插件也没问题 排查半天了 ):
Author
Owner

@Amthurson commented on GitHub (Apr 22, 2025):

我也同样遇到同样问题,版本是1.0.0,服务器是离线的, 配到了另一个ip的text-embedding-interface标准接口服务(已在本地电脑的dify测试过huggingface-tei-0.0.3和openai-api-compatible插件都能正常上传文件返回预期的embedding结果),然而在离线服务器的dify上,使用huggingface-tet-0.0.3上传文件embedding会报错 413 Payload Too Large,我的文件大小只有22KB. 使用openai-api-compatible则报错:PluginInvokeError: {"args":{},"error_type":"ConnectionError","message":"HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /gpt-2/encodings/main/vocab.bpe (Caused by NameResolutionError(\"\u003curllib3.connection.HTTPSConnection object at 0xfffca4233950\u003e: Failed to resolve 'openaipublic.blob.core.windows.net' ([Errno -3] Temporary failure in name resolution)\"))"},目前不知道如何解决

@Amthurson commented on GitHub (Apr 22, 2025): 我也同样遇到同样问题,版本是1.0.0,服务器是离线的, 配到了另一个ip的text-embedding-interface标准接口服务(已在本地电脑的dify测试过huggingface-tei-0.0.3和openai-api-compatible插件都能正常上传文件返回预期的embedding结果),然而在离线服务器的dify上,使用huggingface-tet-0.0.3上传文件embedding会报错 413 Payload Too Large,我的文件大小只有22KB. 使用openai-api-compatible则报错:PluginInvokeError: {\"args\":{},\"error_type\":\"ConnectionError\",\"message\":\"HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /gpt-2/encodings/main/vocab.bpe (Caused by NameResolutionError(\\\"\\u003curllib3.connection.HTTPSConnection object at 0xfffca4233950\\u003e: Failed to resolve 'openaipublic.blob.core.windows.net' ([Errno -3] Temporary failure in name resolution)\\\"))\"},目前不知道如何解决
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7471