dify access api #8544

Closed
opened 2026-02-21 18:26:15 -05:00 by yindo · 3 comments
Owner

Originally created by @cqray1990 on GitHub (Feb 23, 2025).

Self Checks

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

1. Is this request related to a challenge you're experiencing? Tell me about your story.

         curl -X POST 'http://localhost/v1/chat-messages' \
          --header 'Authorization: Bearer app-cUiq03CAQUrpEBYP7Cs4HQxU' \
          --header 'Content-Type: application/json' \
          --data-raw '{
              "inputs": {},
              "query": "描述这张图片",
              "response_mode": "streaming",
              "conversation_id": "",
              "user": "abc-123",
              "files": [
                {
                  "type": "image",
                  "transfer_method": "remote_url",
                  "url": "https://cloud.dify.ai/logo/logo-site.png"
                }
              ]
              
          }'

raise error:

        Request failed with status code: 400
        Error: {"code": "invalid_param", "message": "Reached maximum retries (3) for URL https://cloud.dify.ai/logo/logo-site.png", "status": 400}

but this is OK.

          curl -X POST 'http://localhost/v1/chat-messages' \
          --header 'Authorization: Bearer app-cUiq03CAQUrpEBYP7Cs4HQxU' \
          --header 'Content-Type: application/json' \
          --data-raw '{
              "inputs": {},
              "query": "描述这张图片",
              "response_mode": "streaming",
              "conversation_id": ""
              
          }'

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @cqray1990 on GitHub (Feb 23, 2025). ### Self Checks - [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. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. curl -X POST 'http://localhost/v1/chat-messages' \ --header 'Authorization: Bearer app-cUiq03CAQUrpEBYP7Cs4HQxU' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": {}, "query": "描述这张图片", "response_mode": "streaming", "conversation_id": "", "user": "abc-123", "files": [ { "type": "image", "transfer_method": "remote_url", "url": "https://cloud.dify.ai/logo/logo-site.png" } ] }' raise error: Request failed with status code: 400 Error: {"code": "invalid_param", "message": "Reached maximum retries (3) for URL https://cloud.dify.ai/logo/logo-site.png", "status": 400} but this is OK. curl -X POST 'http://localhost/v1/chat-messages' \ --header 'Authorization: Bearer app-cUiq03CAQUrpEBYP7Cs4HQxU' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": {}, "query": "描述这张图片", "response_mode": "streaming", "conversation_id": "" }' ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 🌚 invalid label 2026-02-21 18:26:15 -05:00
yindo closed this issue 2026-02-21 18:26:15 -05:00
Author
Owner

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

I found a similar unsolved discussion regarding the "Reached maximum retries" error when using the HTTP request component in Dify [1]. Additionally, there is information on how the Dify API handles retries for remote URL requests. The API attempts the request up to a maximum number of retries specified by SSRF_DEFAULT_MAX_RETRIES. A retry is triggered if the response status code is in the STATUS_FORCELIST, which includes status codes like 429, 500, 502, 503, and 504, or if a httpx.RequestError occurs. The retries use an exponential backoff strategy [2].

To address this issue, you might want to check the following:

  1. URL Validity: Ensure that the URL is accessible and valid. Sometimes, transient network issues can cause retries to fail.

  2. Retry Configuration: Consider increasing the maximum number of retries or adjusting the backoff strategy if possible. This can be done by setting the max_retries parameter in the request function.

  3. Server Response: Check if the server hosting the URL is responding with any of the retry-triggering status codes.

If these steps do not resolve the issue, further investigation into the server's response and network conditions might be necessary.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Feb 23, 2025): <!-- Answer --> I found a similar unsolved discussion regarding the "Reached maximum retries" error when using the HTTP request component in Dify <sup>[[1]](https://github.com/langgenius/dify/discussions/10322)</sup>. Additionally, there is information on how the Dify API handles retries for remote URL requests. The API attempts the request up to a maximum number of retries specified by `SSRF_DEFAULT_MAX_RETRIES`. A retry is triggered if the response status code is in the `STATUS_FORCELIST`, which includes status codes like 429, 500, 502, 503, and 504, or if a `httpx.RequestError` occurs. The retries use an exponential backoff strategy <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/helper/ssrf_proxy.py)</sup>. To address this issue, you might want to check the following: 1. **URL Validity**: Ensure that the URL is accessible and valid. Sometimes, transient network issues can cause retries to fail. 2. **Retry Configuration**: Consider increasing the maximum number of retries or adjusting the backoff strategy if possible. This can be done by setting the `max_retries` parameter in the request function. 3. **Server Response**: Check if the server hosting the URL is responding with any of the retry-triggering status codes. If these steps do not resolve the issue, further investigation into the server's response and network conditions might be necessary. <!-- 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/366cd60a-2312-44e0-bd9b-769d643df8ea?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/366cd60a-2312-44e0-bd9b-769d643df8ea?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/366cd60a-2312-44e0-bd9b-769d643df8ea?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/366cd60a-2312-44e0-bd9b-769d643df8ea?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/366cd60a-2312-44e0-bd9b-769d643df8ea?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/366cd60a-2312-44e0-bd9b-769d643df8ea?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/366cd60a-2312-44e0-bd9b-769d643df8ea?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Feb 23, 2025):

For self deployed version, some urls are restricted, you need to add it in the squid.conf, after that you should be able to access the resources as expected.

This is a feature request template. Please choose it wisely when you open an issue.

@crazywoola commented on GitHub (Feb 23, 2025): For self deployed version, some urls are restricted, you need to add it in the squid.conf, after that you should be able to access the resources as expected. This is a feature request template. Please choose it wisely when you open an issue.
Author
Owner

@caiyuanhangDicp commented on GitHub (Mar 25, 2025):

The same issue occurs when accessing the external knowledge base; sometimes it works, and other times it results in an error: 'Reached maximum retries (3) for URL http://xxxx/api/retrieval'.

@caiyuanhangDicp commented on GitHub (Mar 25, 2025): The same issue occurs when accessing the external knowledge base; sometimes it works, and other times it results in an error: 'Reached maximum retries (3) for URL http://xxxx/api/retrieval'.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8544