Failed to execute code #6791

Closed
opened 2026-02-21 18:17:19 -05:00 by yindo · 5 comments
Owner

Originally created by @ddbbcc on GitHub (Nov 15, 2024).

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

Failed to execute code

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

  1. 在启用业务服务之前,我们需要先部署 PostgreSQL / Redis / Weaviate(如果本地没有的话),可以通过以下命令启动:
    cd docker
    cp middleware.env.example middleware.env
    docker compose -f docker-compose.middleware.yaml up -d
    image
    2.服务端部署 启动 API 服务
    flask run --host 0.0.0.0 --port=5001 --debug
    3.启动 Worker 服务
    celery -A app.celery worker -P gevent -c 1 -Q dataset,generation,mail,ops_trace --loglevel INFO
    4.前端页面部署 启动 web 服务
    npm run start
    执行
    image
    image
    Failed to execute code, which is likely a network issue, please check if the sandbox service is running. ( Error: Failed to execute code, got status code 403, please check if the sandbox service is running )

✔️ Expected Behavior

能够顺利执行code 脚本

Actual Behavior

没有执行code

Originally created by @ddbbcc on GitHub (Nov 15, 2024). ### 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 Failed to execute code ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce 1. 在启用业务服务之前,我们需要先部署 PostgreSQL / Redis / Weaviate(如果本地没有的话),可以通过以下命令启动: cd docker cp middleware.env.example middleware.env docker compose -f docker-compose.middleware.yaml up -d ![image](https://github.com/user-attachments/assets/197ae80f-5700-46f4-a6c8-96d4cd70c9ec) 2.服务端部署 启动 API 服务 flask run --host 0.0.0.0 --port=5001 --debug 3.启动 Worker 服务 celery -A app.celery worker -P gevent -c 1 -Q dataset,generation,mail,ops_trace --loglevel INFO 4.前端页面部署 启动 web 服务 npm run start 执行 ![image](https://github.com/user-attachments/assets/87d95c3e-dd48-4aac-9326-1b06df36e98d) ![image](https://github.com/user-attachments/assets/95d826cc-3360-4055-8c38-47803797ff2d) Failed to execute code, which is likely a network issue, please check if the sandbox service is running. ( Error: Failed to execute code, got status code 403, please check if the sandbox service is running ) ### ✔️ Expected Behavior 能够顺利执行code 脚本 ### ❌ Actual Behavior 没有执行code
yindo added the 🐞 bug label 2026-02-21 18:17:19 -05:00
yindo closed this issue 2026-02-21 18:17:19 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 15, 2024):

Hello @ddbbcc! I'm here to assist you with any bugs, questions, or contributions you have for the project. I can help you solve issues while waiting for a human maintainer.

I found some similar discussions that might be relevant to your issue:

  1. Help Problem starting the project - This discussion is still open and might contain useful insights.
  2. sandbox can't use - Another open discussion that could be related to your problem.
  3. Sandbox service start - This is also an open discussion that might help you troubleshoot the issue.

Regarding the 403 status code you're encountering, it is often caused by issues with access permissions or an invalid Authorization header format. Ensure that the Authorization header is in the correct format: 'Bearer <api-key>' [1].

Additionally, verify that the sandbox service is running correctly. You can do this by checking the status of the Docker containers with docker compose ps and ensuring the sandbox container is up. You can also check the health of the sandbox service by running curl -f http://localhost:8194/health to see if it returns a successful response [2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 15, 2024): <!-- Greeting --> Hello @ddbbcc! I'm here to assist you with any bugs, questions, or contributions you have for the project. I can help you solve issues while waiting for a human maintainer. <!-- Answer --> I found some similar discussions that might be relevant to your issue: 1. [Help Problem starting the project](https://github.com/langgenius/dify/discussions/9751) - This discussion is still open and might contain useful insights. 2. [sandbox can't use](https://github.com/langgenius/dify/discussions/8612) - Another open discussion that could be related to your problem. 3. [Sandbox service start](https://github.com/langgenius/dify/discussions/8520) - This is also an open discussion that might help you troubleshoot the issue. Regarding the 403 status code you're encountering, it is often caused by issues with access permissions or an invalid Authorization header format. Ensure that the Authorization header is in the correct format: `'Bearer <api-key>'` <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/jp/.gitbook/assets/Dify-test.openapi.jp.json)</sup>. Additionally, verify that the sandbox service is running correctly. You can do this by checking the status of the Docker containers with `docker compose ps` and ensuring the `sandbox` container is up. You can also check the health of the sandbox service by running `curl -f http://localhost:8194/health` to see if it returns a successful response <sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/getting-started/install-self-hosted/docker-compose.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Nov 15, 2024):

Close due to #1542 And this is a network issue, please disable VPN if you are using one.

@crazywoola commented on GitHub (Nov 15, 2024): Close due to #1542 And this is a network issue, please disable VPN if you are using one.
Author
Owner

@chinamerp commented on GitHub (Nov 15, 2024):

I encountered the same problem, but I don't know how to solve it.
The error message is “Failed to execute code, which is likely a network issue, please check if the sandbox service is running. ( Error: timed out )”

@chinamerp commented on GitHub (Nov 15, 2024): I encountered the same problem, but I don't know how to solve it. The error message is “Failed to execute code, which is likely a network issue, please check if the sandbox service is running. ( Error: timed out )”
Author
Owner

@leoncool23 commented on GitHub (Nov 26, 2024):

I encountered the same problem, but I don't know how to solve it. The error message is “Failed to execute code, which is likely a network issue, please check if the sandbox service is running. ( Error: timed out )”

I encountered the same problem, how to solve it???

@leoncool23 commented on GitHub (Nov 26, 2024): > I encountered the same problem, but I don't know how to solve it. The error message is “Failed to execute code, which is likely a network issue, please check if the sandbox service is running. ( Error: timed out )” I encountered the same problem, how to solve it???
Author
Owner

@mrkenknight commented on GitHub (Dec 4, 2024):

When you run the service using docker/docker-compose.yaml, carefully check the port configuration and docker/.env file
For example:
I commented out the "SANDBOX_PORT" line in the .env file and it worked

@mrkenknight commented on GitHub (Dec 4, 2024): When you run the service using docker/docker-compose.yaml, carefully check the port configuration and docker/.env file For example: I commented out the "SANDBOX_PORT" line in the .env file and it worked
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6791