http api error
Self Checks
- [x] I have read the Contributing Guide and Language Policy.
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing 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.9.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
2025-10-03 05:24:36.643 WARNING [GraphWorker-0] [ssrf_proxy.py:107] - Request to URL https://www.shuipu.net/ai/cache/get failed on attempt 1: 500 Internal Server Error 2025-10-03 05:24:36.643 WARNING [GraphWorker-0] [node.py:130] - http request node 1759466572954 failed to run: 500 Internal Server Error 2025-10-03 05:24:36.644 ERROR [GraphDispatcher] [error_handler.py:101] - Node 1759466572954 failed with ABORT strategy: 500 Internal Server Error 2025-10-03 05:24:36.846 ERROR [Thread-141 (_generate_worker)] [workflow_entry.py:110] - Unknown Error when workflow entry running Traceback (most recent call last): File "/app/api/core/workflow/workflow_entry.py", line 106, in run yield from generator File "/app/api/core/workflow/graph_engine/graph_engine.py", line 262, in run raise self._graph_execution.error RuntimeError: 500 Internal Server Error
API(https://www.shuipu.net/ai/cache/get ) is right
✔️ Expected Behavior
return data
❌ Actual Behavior
error
A 500 Internal Server Error from your HTTP request node can be caused by several factors in this configuration. The most common issues are:
- The API may require specific headers (like
Content-Type) or a POST body, even if it's empty. Not providing these can trigger a 500 error from the backend service. Try adding aContent-Type: application/jsonheader and a minimal body (e.g.,{}) to see if the error changes or resolves reference. - Check the API documentation for required headers, authentication, or body format. Some APIs expect a POST body even if parameters are sent as query strings reference.
- SSL verification issues can cause node failures in Docker. If you suspect SSL problems, set
HTTP_REQUEST_NODE_SSL_VERIFY=Falsein your.envfile and restart your containers to reliably disable SSL verification reference. - Proxy or network restrictions (like SSRF proxy or Docker network config) can block requests. While the HTTP Request node usually bypasses the SSRF proxy, double-check your Docker and proxy settings if you see persistent errors reference.
- Server-side issues (overload, bugs, or misconfiguration) can also cause 500 errors. If possible, check the logs on the API server for more details reference.
To isolate the issue, test the same request with curl or Postman, including headers and a minimal body, and compare the response. If you get a different result, adjust your Dify node configuration to match what works externally.
If you can share more details from the API server logs or clarify the expected request format, I can help further troubleshoot.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
i have the same problem
2025-10-21 05:36:00.609 ERROR [Thread-157 (_generate_worker)] [workflow_entry.py:110] - Unknown Error when workflow entry running
Traceback (most recent call last):
File "/app/api/core/workflow/workflow_entry.py", line 106, in run
yield from generator
File "/app/api/core/workflow/graph_engine/graph_engine.py", line 262, in run
raise self._graph_execution.error
File "/app/api/core/workflow/graph_engine/orchestration/dispatcher.py", line 89, in _dispatcher_loop
self._event_handler.dispatch(event)
File "/app/api/core/workflow/graph_engine/event_management/event_handlers.py", line 97, in dispatch
return self._dispatch(event)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/functools.py", line 949, in _method
return method.__get__(obj, cls)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/workflow/graph_engine/event_management/event_handlers.py", line 215, in _
result = self._error_handler.handle_node_failure(event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/workflow/graph_engine/error_handler.py", line 65, in handle_node_failure
node = self._graph.nodes[event.node_id]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'unknown'
i have the same problem
2025-10-21 05:36:00.609 ERROR [Thread-157 (_generate_worker)] [workflow_entry.py:110] - Unknown Error when workflow entry running Traceback (most recent call last): File "/app/api/core/workflow/workflow_entry.py", line 106, in run yield from generator File "/app/api/core/workflow/graph_engine/graph_engine.py", line 262, in run raise self._graph_execution.error File "/app/api/core/workflow/graph_engine/orchestration/dispatcher.py", line 89, in _dispatcher_loop self._event_handler.dispatch(event) File "/app/api/core/workflow/graph_engine/event_management/event_handlers.py", line 97, in dispatch return self._dispatch(event) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/functools.py", line 949, in _method return method.__get__(obj, cls)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/workflow/graph_engine/event_management/event_handlers.py", line 215, in _ result = self._error_handler.handle_node_failure(event) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/workflow/graph_engine/error_handler.py", line 65, in handle_node_failure node = self._graph.nodes[event.node_id] ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ KeyError: 'unknown'
I printed it (psycopg2.OperationalError) FATAL: terminating connection due to idle-in-transaction timeout
2025-10-21 18:14:40.482 INFO [GraphWorker-0] [_client.py:1038] - HTTP Request: POST http://vps-dify-plugin-daemon:5002/plugin/d78743a9-1e1d-47ba-a170-d3a42b151863/dispatch/llm/invoke "HTTP/1.1 200 OK"
2025-10-21 18:20:33.600 INFO [GraphWorker-0] [_client.py:1038] - HTTP Request: GET http://vps-dify-plugin-daemon:5002/plugin/d78743a9-1e1d-47ba-a170-d3a42b151863/management/tool?provider=repair_json&plugin_id=ivan97%2Frepair_json "HTTP/1.1 200 OK"
2025-10-21 18:20:33.714 INFO [GraphWorker-0] [_client.py:1038] - HTTP Request: POST http://vps-dify-plugin-daemon:5002/plugin/d78743a9-1e1d-47ba-a170-d3a42b151863/dispatch/tool/invoke "HTTP/1.1 200 OK"
[on_tool_execution]
Tool: repair_json
Outputs: {"type":"json","message":{"json_object":{"result":"{\"version\": \"2.0.0\", \"category\": \"\\u4ed9\\u4fa0\", \"title\": \"\\u6211\\u53ea\\u60f3\\u548c\\u8001\\u725b\\u770b\\u904d\\u7e41\\u534e\", \"mainline\": \"\\u957f\\u751f\\u8005\\u7684\\u65f6\\u95f4\\u6f2b\\u6e38\", \"value_kernel\": \"\\u4e8e\\u65e0\\u5c3d\\u5149\\u9634\\u4e2d\\u5b88\\u62a4\\u5239\\u90a3\\u7684\\u6e29\\u6696\\u4e0e\\u7f8e\\u597d\\uff0c\\u89c1\\u8bc1\\u6587\\u660e\\u7684\\u5174\\u8870\\u66f4\\u8fed\\uff0c\\u5e76\\u5728\\u5fc5\\u8981\\u65f6\\u4ee5\\u7edd\\u5bf9\\u529b\\u91cf\\u634d\\u536b\\u8fd9\\u4efd\\u5b81\\u9759\\u7684\\u65e5\\u5e38\\u3002\", \"selling_point\": \"\\u957f\\u751f\\u82df\\u738b\\u4e0e\\u4e00\\u5934\\u725b\\u7684\\u4e07\\u53e4\\u65c5\\u884c\\uff0c\\u7528\\u70bc\\u6c14\\u671f\\u4fee\\u4e3a\\u5728\\u4e0d\\u540c\\u4fee\\u4ed9\\u65f6\\u4ee3\\u626e\\u732a\\u5403\\u864e\\uff0c\\u4e8e\\u8f7b\\u677e\\u65e5\\u5e38\\u4e2d\\u5c55\\u73b0\\u706d\\u4e16\\u7ea7\\u7684\\u6050\\u6016\\u5b9e\\u529b\\u53cd\\u5dee\\u
(psycopg2.OperationalError) FATAL: terminating connection due to idle-in-transaction timeout
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
(Background on this error at: https://sqlalche.me/e/20/e3q8)
id='77818f54-efdb-441f-b928-8f38cb60a349' node_id='unknown' node_type=<NodeType.CODE: 'code'> in_iteration_id=None in_loop_id=None node_version='1' node_run_result=NodeRunResult(status=<WorkflowNodeExecutionStatus.PENDING: 'pending'>, inputs={}, process_data={}, outputs={}, metadata={}, llm_usage=LLMUsage(prompt_tokens=0, prompt_unit_price=Decimal('0.0'), prompt_price_unit=Decimal('0.0'), prompt_price=Decimal('0.0'), completion_tokens=0, completion_unit_price=Decimal('0.0'), completion_price_unit=Decimal('0.0'), completion_price=Decimal('0.0'), total_tokens=0, total_price=Decimal('0.0'), currency='USD', latency=0.0), edge_source_handle='source', error='', error_type='', retry_index=0) error='(psycopg2.OperationalError) FATAL: terminating connection due to idle-in-transaction timeout\nserver closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.\n\n(Background on this error at: https://sqlalche.me/e/20/e3q8)' start_at=datetime.datetime(2025, 10, 21, 18, 20, 33, 469747)
2025-10-21 18:20:33.994 ERROR [GraphDispatcher] [dispatcher.py:123] - Dispatcher error
Traceback (most recent call last):
File "/app/api/core/workflow/graph_engine/orchestration/dispatcher.py", line 105, in _dispatcher_loop
self._event_handler.dispatch(event)
File "/app/api/core/workflow/graph_engine/event_management/event_handlers.py", line 99, in dispatch
return self._dispatch(event)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/functools.py", line 949, in _method
return method.__get__(obj, cls)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/workflow/graph_engine/event_management/event_handlers.py", line 234, in _
result = self._error_handler.handle_node_failure(event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/workflow/graph_engine/error_handler.py", line 68, in handle_node_failure
node = self._graph.nodes[event.node_id]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'unknown'
2025-10-21 18:20:34.128 ERROR [Thread-9 (_generate_worker)] [workflow_entry.py:111] - Unknown Error when workflow entry running
Traceback (most recent call last):
File "/app/api/core/workflow/workflow_entry.py", line 107, in run
yield from generator
File "/app/api/core/workflow/graph_engine/graph_engine.py", line 268, in run
raise self._graph_execution.error
File "/app/api/core/workflow/graph_engine/orchestration/dispatcher.py", line 105, in _dispatcher_loop
self._event_handler.dispatch(event)
File "/app/api/core/workflow/graph_engine/event_management/event_handlers.py", line 99, in dispatch
return self._dispatch(event)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/functools.py", line 949, in _method
return method.__get__(obj, cls)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/workflow/graph_engine/event_management/event_handlers.py", line 234, in _
result = self._error_handler.handle_node_failure(event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/workflow/graph_engine/error_handler.py", line 68, in handle_node_failure
node = self._graph.nodes[event.node_id]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'unknown'
The problem is with super long transactions, I adjusted the postgres configuration but this might not be good practice, can it be optimized in dify?
idle_in_transaction_session_timeout = '3600s'
In addition, this error event does not have a node id, so it needs to be handled in a more friendly way.
Hi, @anylineorg. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.
Issue Summary:
- You reported a 500 Internal Server Error when making an HTTP request to an API endpoint using Dify v1.9.1 in a self-hosted Docker setup.
- The API itself is functional, but errors occur during request handling.
- Another user confirmed the issue and shared logs indicating a PostgreSQL idle-in-transaction timeout causing connection termination.
- The error event lacks a node ID, resulting in a KeyError.
- Suggestions include optimizing transaction handling in Dify and improving error handling for missing node IDs.
Next Steps:
- Please let me know if this issue is still relevant with the latest version of Dify by commenting here.
- If I don’t hear back within 15 days, this issue will be automatically closed.
Thank you for your understanding and contribution!