dify hitTesting HTTP/1.1 500 Internal Server Error by ragflow
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
Description
### Self Checks
- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [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, 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.14.2
### Cloud or Self Hosted
Self Hosted (Docker)
### Steps to reproduce
api-1 | /app/api/.venv/lib/python3.12/site-packages/httpx/_models.py:408: DeprecationWarning: Use 'content=<...>' to upload raw bytes/text content.
api-1 | headers, stream = encode_request(
api-1 | 2026-08-10 13:43:53.962 INFO [Dummy-118] [_client.py:1025] 14ec8d87c9c454fa871769d65891cf62 - HTTP Request: POST http://10.168.45.21:3000/api/v1/dify/retrieval "HTTP/1.1 500 Internal Server Error"
api-1 | 2026-08-10 13:43:53.963 WARNING [Dummy-118] [ssrf_proxy.py:195] 14ec8d87c9c454fa871769d65891cf62 - Received status code 500 for URL http://10.168.45.21:3000/api/v1/dify/retrieval which is in the force list
ssrf_proxy-1 | 1786340633.961 1472 192.168.224.5 TCP_MISS/500 319 POST http://10.168.45.21:3000/api/v1/dify/retrieval - HIER_DIRECT/10.168.45.21 application/json
api-1 | 2026-08-10 13:43:55.804 INFO [Dummy-118] [_client.py:1025] 14ec8d87c9c454fa871769d65891cf62 - HTTP Request: POST http://10.168.45.21:3000/api/v1/dify/retrieval "HTTP/1.1 500 Internal Server Error"
api-1 | 2026-08-10 13:43:55.805 WARNING [Dummy-118] [ssrf_proxy.py:195] 14ec8d87c9c454fa871769d65891cf62 - Received status code 500 for URL http://10.168.45.21:3000/api/v1/dify/retrieval which is in the force list
ssrf_proxy-1 | 1786340635.803 1337 192.168.224.5 TCP_MISS/500 319 POST http://10.168.45.21:3000/api/v1/dify/retrieval - HIER_DIRECT/10.168.45.21 application/json
api-1 | 2026-08-10 13:43:58.304 INFO [Dummy-118] [_client.py:1025] 14ec8d87c9c454fa871769d65891cf62 - HTTP Request: POST http://10.168.45.21:3000/api/v1/dify/retrieval "HTTP/1.1 500 Internal Server Error"
api-1 | 2026-08-10 13:43:58.305 WARNING [Dummy-118] [ssrf_proxy.py:195] 14ec8d87c9c454fa871769d65891cf62 - Received status code 500 for URL http://10.168.45.21:3000/api/v1/dify/retrieval which is in the force list
ssrf_proxy-1 | 1786340638.303 1494 192.168.224.5 TCP_MISS/500 319 POST http://10.168.45.21:3000/api/v1/dify/retrieval - HIER_DIRECT/10.168.45.21 application/json
api-1 | 2026-08-10 13:44:01.656 INFO [Dummy-118] [_client.py:1025] 14ec8d87c9c454fa871769d65891cf62 - HTTP Request: POST http://10.168.45.21:3000/api/v1/dify/retrieval "HTTP/1.1 500 Internal Server Error"
api-1 | 2026-08-10 13:44:01.657 WARNING [Dummy-118] [ssrf_proxy.py:195] 14ec8d87c9c454fa871769d65891cf62 - Received status code 500 for URL http://10.168.45.21:3000/api/v1/dify/retrieval which is in the force list
api-1 | 2026-08-10 13:44:01.657 ERROR [Dummy-118] [app.py:875] 14ec8d87c9c454fa871769d65891cf62 - Exception on /console/api/datasets/39ce4a3a-0689-460b-aea7-3dfc36a7e82d/external-hit-testing [POST]
api-1 | Traceback (most recent call last):
api-1 | File "/app/api/controllers/console/datasets/external.py", line 301, in post
api-1 | response = HitTestingService.external_retrieve(
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/services/hit_testing_service.py", line 201, in external_retrieve
api-1 | all_documents = RetrievalService.external_retrieve(
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/core/rag/datasource/retrieval_service.py", line 191, in external_retrieve
api-1 | all_documents = ExternalDatasetService.fetch_external_knowledge_retrieval(
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/services/external_knowledge_service.py", line 347, in fetch_external_knowledge_retrieval
api-1 | response = ExternalDatasetService.process_external_api(
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/services/external_knowledge_service.py", line 223, in process_external_api
api-1 | response: httpx.Response = _METHOD_MAP[method_lc](data=json.dumps(settings.params), files=files, **kwargs)
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/core/helper/ssrf_proxy.py", line 217, in post
api-1 | return make_request("POST", url, max_retries=max_retries, **kwargs)
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/core/helper/ssrf_proxy.py", line 209, in make_request
api-1 | raise MaxRetriesExceededError(f"Reached maximum retries ({max_retries}) for URL {url}")
api-1 | core.helper.ssrf_proxy.MaxRetriesExceededError: Reached maximum retries (3) for URL http://10.168.45.21:3000/api/v1/dify/retrieval
api-1 |
api-1 | During handling of the above exception, another exception occurred:
api-1 |
api-1 | Traceback (most recent call last):
api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
api-1 | rv = self.dispatch_request()
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request
api-1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask_restx/api.py", line 404, in wrapper
api-1 | resp = resource(*args, **kwargs)
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view
api-1 | return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask_restx/resource.py", line 41, in dispatch_request
api-1 | resp = meth(*args, **kwargs)
api-1 | ^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/controllers/console/wraps.py", line 225, in decorated
api-1 | return view(*args, **kwargs)
api-1 | ^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/libs/login.py", line 100, in decorated_view
api-1 | return current_app.ensure_sync(func)(*args, **kwargs)
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/controllers/console/wraps.py", line 44, in decorated
api-1 | return view(*args, **kwargs)
api-1 | ^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/controllers/console/datasets/external.py", line 311, in post
api-1 | raise InternalServerError(str(e))
api-1 | werkzeug.exceptions.InternalServerError: 500 Internal Server Error: Reached maximum retries (3) for URL http://10.168.45.21:3000/api/v1/dify/retrieval
nginx-1 | 10.168.22.86 - - [10/Aug/2026:05:44:01 +0000] "POST /console/api/datasets/39ce4a3a-0689-460b-aea7-3dfc36a7e82d/external-hit-testing HTTP/1.1" 500 147 "http://dify.ops.test.dwzq/datasets/39ce4a3a-0689-460b-aea7-3dfc36a7e82d/hitTesting" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36" "-"
### ✔️ Expected Behavior
no
### ❌ Actual Behavior
Contributor guide
Research direction
Start at api/controllers/console/datasets/external.py and trace the request through hit_testing_service.py, retrieval_service.py, external_knowledge_service.py, and core/helper/ssrf_proxy.py. Reproduce the RAGFlow retrieval request, determine why the external hit-testing endpoint returns 500 after three retries, and verify the reported failure no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, flask, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100