Failed to execute code, which is likely a network issue, please check if the sandbox service is running #21218

Closed
opened 2026-02-21 20:11:28 -05:00 by yindo · 3 comments
Owner

Originally created by @zt-x on GitHub (Dec 22, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.11

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

api-1 | 2025-12-23 03:16:33.808 ERROR [Thread-25 (_generate_worker)] [workflow_entry.py:111] - Unknown Error when workflow entry running
api-1 | Traceback (most recent call last):
api-1 | File "/app/api/core/workflow/workflow_entry.py", line 107, in run
api-1 | yield from generator
api-1 | File "/app/api/core/workflow/graph_engine/graph_engine.py", line 270, in run
api-1 | raise self._graph_execution.error
api-1 | RuntimeError: Failed to execute code, which is likely a network issue, please check if the sandbox service is running. ( Error: [Errno -2] Name or service not known )

✔️ Expected Behavior

it happened when i try to use a code node.

Actual Behavior

No response

Originally created by @zt-x on GitHub (Dec 22, 2025). ### 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.11 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="1912" height="948" alt="Image" src="https://github.com/user-attachments/assets/226c6f0e-5506-441b-b28e-e6dfee79df3d" /> api-1 | 2025-12-23 03:16:33.808 ERROR [Thread-25 (_generate_worker)] [workflow_entry.py:111] - Unknown Error when workflow entry running api-1 | Traceback (most recent call last): api-1 | File "/app/api/core/workflow/workflow_entry.py", line 107, in run api-1 | yield from generator api-1 | File "/app/api/core/workflow/graph_engine/graph_engine.py", line 270, in run api-1 | raise self._graph_execution.error api-1 | RuntimeError: Failed to execute code, which is likely a network issue, please check if the sandbox service is running. ( Error: [Errno -2] Name or service not known ) ### ✔️ Expected Behavior it happened when i try to use a code node. ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 20:11:28 -05:00
yindo closed this issue 2026-02-21 20:11:28 -05:00
Author
Owner

@zt-x commented on GitHub (Dec 22, 2025):

Image
@zt-x commented on GitHub (Dec 22, 2025): <img width="1008" height="651" alt="Image" src="https://github.com/user-attachments/assets/da213247-2d19-4b3f-aa43-d7b420afb8ea" />
Author
Owner

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

Your sandbox container is running, but the error (“Name or service not known”) means the API container can’t resolve the hostname sandbox, which is usually a Docker network/DNS issue. Here’s what to check:

  • Make sure both the API and sandbox containers are attached to the same Docker network (typically ssrf_proxy_network). You can verify this with docker network inspect ssrf_proxy_network and check that both containers are listed.
  • Check the health of the sandbox container: run docker inspect <sandbox-container-id> and look for the Health status. It should be “healthy” (not just “running”).
  • From inside the API container (docker exec -it <api-container-id> /bin/sh), try curl http://sandbox:8194/health or ping sandbox to test DNS resolution and connectivity.
  • If DNS resolution fails, use docker network inspect to find the sandbox container’s IP address and try connecting to that IP from the API container.
  • Double-check your docker-compose.yaml and .env files to ensure CODE_EXECUTION_ENDPOINT is set to http://sandbox:8194 and both services are on the same network.
  • Restart both containers (docker compose restart api sandbox) to clear any transient DNS issues.
  • If you’re using Podman Compose, you must explicitly define and assign a network in your compose file for service discovery to work. See this discussion.

If the issue persists, try recreating the Docker network (docker compose down -v && docker compose up -d) and ensure your environment variables match the latest configuration. This error is almost always a network or DNS misconfiguration between containers, not a problem with the sandbox service itself.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 22, 2025): <!-- Answer --> Your sandbox container is running, but the error (“Name or service not known”) means the API container can’t resolve the hostname sandbox, which is usually a Docker network/DNS issue. Here’s what to check: - Make sure both the API and sandbox containers are attached to the same Docker network (typically ssrf_proxy_network). You can verify this with `docker network inspect ssrf_proxy_network` and check that both containers are listed. - Check the health of the sandbox container: run `docker inspect <sandbox-container-id>` and look for the Health status. It should be “healthy” (not just “running”). - From inside the API container (`docker exec -it <api-container-id> /bin/sh`), try `curl http://sandbox:8194/health` or `ping sandbox` to test DNS resolution and connectivity. - If DNS resolution fails, use `docker network inspect` to find the sandbox container’s IP address and try connecting to that IP from the API container. - Double-check your docker-compose.yaml and .env files to ensure CODE_EXECUTION_ENDPOINT is set to `http://sandbox:8194` and both services are on the same network. - Restart both containers (`docker compose restart api sandbox`) to clear any transient DNS issues. - If you’re using Podman Compose, you must explicitly define and assign a network in your compose file for service discovery to work. See [this discussion](https://github.com/langgenius/dify/issues/16967#issuecomment-2760058205). If the issue persists, try recreating the Docker network (`docker compose down -v && docker compose up -d`) and ensure your environment variables match the latest configuration. This error is almost always a network or DNS misconfiguration between containers, not a problem with the sandbox service itself. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/ea816074-4400-4416-a361-ba984a2622bb?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ea816074-4400-4416-a361-ba984a2622bb?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ea816074-4400-4416-a361-ba984a2622bb?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ea816074-4400-4416-a361-ba984a2622bb?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ea816074-4400-4416-a361-ba984a2622bb?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ea816074-4400-4416-a361-ba984a2622bb?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ea816074-4400-4416-a361-ba984a2622bb?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Your%20sandbox%20container%20is%20running%2C%20but%20the%20error%20%28%E2%80%9CName%20or%20service%20not%20known%E2%80%9D%29%20means%20the%20API%20container%20can%E2%80%99t%20resolve%20the%20hostname%20sandbox%2C%20which%20is%20usually%20a%20Docker%20network/DNS%20issue.%20Here%E2%80%99s%20what%20to%20check%3A%0A%0A-%20Make%20sure%20both%20the%20API%20and%20sandbox%20containers%20are%20attached%20to%20the%20same%20Docker%20network%20%28typically%20ssrf_proxy_network%29.%20You%20can%20verify%20this%20with%20%60docker%20network%20inspect%20ssrf_proxy_network%60%20and%20check%20that%20both%20containers%20are%20listed.%0A-%20Check%20the%20health%20of%20the%20sandbox%20container%3A%20run%20%60docker%20inspect%20%3Csandbox-container-id%3E%60%20and%20look%20for%20the%20Health%20status.%20It%20should%20be%20%E2%80%9Chealthy%E2%80%9D%20%28not%20just%20%E2%80%9Crunning%E2%80%9D%29.%0A-%20From%20inside%20the%20API%20container%20%28%60docker%20exec%20-it%20%3Capi-container-id%3E%20/bin/sh%60%29%2C%20try%20%60curl%20http%3A//sandbox%3A8194/health%60%20or%20%60ping%20sandbox%60%20to%20test%20DNS%20resolution%20and%20connectivity.%0A-%20If%20DNS%20resolution%20fails%2C%20use%20%60docker%20network%20inspect%60%20to%20find%20the%20sandbox%20container%E2%80%99s%20IP%20address%20and%20try%20connecting%20to%20that%20IP%20from%20the%20API%20container.%0A-%20Double-check%20your%20docker-compose.yaml%20and%20.env%20files%20to%20ensure%20CODE_EXECUTION_ENDPOINT%20is%20set%20to%20%60http%3A//sandbox%3A8194%60%20and%20both%20services%20are%20on%20the%20same%20network.%0A-%20Restart%20both%20containers%20%28%60docker%20compose%20restart%20api%20sandbox%60%29%20to%20clear%20any%20transient%20DNS%20issues.%0A-%20If%20you%E2%80%99re%20using%20Podman%20Compose%2C%20you%20must%20explicitly%20define%20and%20assign%20a%20network%20in%20your%20compose%20file%20for%20service%20discovery%20to%20work.%20See%20%5Bthis%20discussion%5D%28https%3A//github.com/langgenius/dify/issues/16967%23issuecomment-2760058205%29.%0A%0AIf%20the%20issue%20persists%2C%20try%20recreating%20the%20Docker%20network%20%28%60docker%20compose%20down%20-v%20%26%26%20docker%20compose%20up%20-d%60%29%20and%20ensure%20your%20environment%20variables%20match%20the%20latest%20configuration.%20This%20error%20is%20almost%20always%20a%20network%20or%20DNS%20misconfiguration%20between%20containers%2C%20not%20a%20problem%20with%20the%20sandbox%20service%20itself.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/30014)
Author
Owner

@fatelei commented on GitHub (Dec 22, 2025):

this dns issue

@fatelei commented on GitHub (Dec 22, 2025): this dns issue
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21218