api call #8527

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

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

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

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

                                import requests
                                import json
                                
                                api_url = "http://localhost/v1/chat-messages"
                                
                                # API Key
                                #api_key = "XXXX"
                                
                                # Request headers
                                headers = {
                                    'Authorization': f'Bearer {api_key}',
                                    'Content-Type': 'application/json',
                                }
                                
                                # Request payload
                                data = {
                                    "inputs": {},
                                    "query": "识别图片",
                                    "response_mode": "blocking",
                                    "conversation_id": "",
                                    "user": "lgx",
                                    "files": [
                                          {
                                            "type": "image",
                                            "transfer_method": "local_file",
                                            "upload_file_id": "./001.jpg"
                                          }
                                        ]
                                }
                                
                                # Send the POST request
                                response = requests.post(api_url, headers=headers,data=json.dumps(data)) #
                                
                                # Check the response
                                if response.status_code == 200:
                                    print("Request successful")
                                    print("Response:", response.json())
                                else:
                                    print(f"Request failed with status code: {response.status_code}")
                                    print("Error:", response.text)

errors"

Request failed with status code: 500
Error: {"code": "internal_server_error", "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.", "status": 500}

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @cqray1990 on GitHub (Feb 22, 2025). ### 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.15 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce import requests import json api_url = "http://localhost/v1/chat-messages" # API Key #api_key = "XXXX" # Request headers headers = { 'Authorization': f'Bearer {api_key}', 'Content-Type': 'application/json', } # Request payload data = { "inputs": {}, "query": "识别图片", "response_mode": "blocking", "conversation_id": "", "user": "lgx", "files": [ { "type": "image", "transfer_method": "local_file", "upload_file_id": "./001.jpg" } ] } # Send the POST request response = requests.post(api_url, headers=headers,data=json.dumps(data)) # # Check the response if response.status_code == 200: print("Request successful") print("Response:", response.json()) else: print(f"Request failed with status code: {response.status_code}") print("Error:", response.text) errors" Request failed with status code: 500 Error: {"code": "internal_server_error", "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.", "status": 500} ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🌚 invalid labels 2026-02-21 18:26:09 -05:00
yindo closed this issue 2026-02-21 18:26:10 -05:00
Author
Owner

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

I found a similar closed issue related to an "Internal Server Error" when using the Get Conversation History Messages API endpoint. This issue was resolved by a pull request that fixed a specific field handling [1].

For your specific case, ensure that the upload_file_id is correctly obtained by uploading the file through the File Upload API before making the request. The upload_file_id should not be a file path but an ID returned from the upload process. Additionally, verify that all server configurations, such as database and Redis settings, are correctly set up in your self-hosted environment [2].

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 22, 2025): <!-- Answer --> I found a similar closed issue related to an "Internal Server Error" when using the Get Conversation History Messages API endpoint. This issue was resolved by a pull request that fixed a specific field handling <sup>[[1]](https://github.com/langgenius/dify/issues/9593)</sup>. For your specific case, ensure that the `upload_file_id` is correctly obtained by uploading the file through the File Upload API before making the request. The `upload_file_id` should not be a file path but an ID returned from the upload process. Additionally, verify that all server configurations, such as database and Redis settings, are correctly set up in your self-hosted environment <sup>[[2]](https://github.com/langgenius/dify/blob/main/docker/.env.example)</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/7bb6126b-a984-4d9a-83d8-8baaf3b64192?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/7bb6126b-a984-4d9a-83d8-8baaf3b64192?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/7bb6126b-a984-4d9a-83d8-8baaf3b64192?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/7bb6126b-a984-4d9a-83d8-8baaf3b64192?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/7bb6126b-a984-4d9a-83d8-8baaf3b64192?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/7bb6126b-a984-4d9a-83d8-8baaf3b64192?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/7bb6126b-a984-4d9a-83d8-8baaf3b64192?feedback_type=other)</sup>
Author
Owner

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

Please provide the container logs instead. If you are using source code to start it, please make sure you can handle it by yourself, otherwise please do not use source code to start it.
We assume you have the ability to resolve issues, especially this backend error, you should provide the container logs.

@crazywoola commented on GitHub (Feb 23, 2025): Please provide the container logs instead. If you are using source code to start it, please make sure you can handle it by yourself, otherwise please do not use source code to start it. We assume you have the ability to resolve issues, especially this backend error, you should provide the container logs.
Author
Owner

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

Also duplicated https://github.com/langgenius/dify/issues/14208, please do not open the same issue for the same problem.

@crazywoola commented on GitHub (Feb 23, 2025): Also duplicated https://github.com/langgenius/dify/issues/14208, please do not open the same issue for the same problem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8527