dify icon indicating copy to clipboard operation
dify copied to clipboard

The "Code Execution" component failed to execute

Open xiaoyesoso opened this issue 9 months ago • 7 comments

Self Checks

  • [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 (我已阅读并同意 Language Policy).
  • [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.0.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

The "code execution" component failed to execute

After upgrading, it will fail: "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 )"

I found that after executing, the sandbox has been in a state of restarting: "docker-sandbox-1 langgenius/dify-sandbox:0.2.10 "/main" sandbox 11 minutes ago Restarting (2) 29 seconds ago"

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

xiaoyesoso avatar Mar 12 '25 02:03 xiaoyesoso

Image

xiaoyesoso avatar Mar 12 '25 02:03 xiaoyesoso

I found some similar issues that might help you resolve the problem with the "Code Execution" component failing due to a network issue.

  1. Open Issue: A similar issue was reported where the sandbox's network configuration in the docker-compose.yaml file was not set correctly, causing problems when executing code in the sandbox. The suggested solution is to add the 'default' network to the Dify sandbox configuration. This allows the sandbox to connect to both the 'ssrf_proxy_network' and the 'default' network, which might resolve network-related issues [1].

  2. Closed Issue: Another issue suggested modifying Docker's DNS settings to resolve temporary failures in name resolution. This involves editing the Docker daemon configuration file (/etc/docker/daemon.json) to specify DNS servers and adding a dns section under services in your docker-compose.yml. Restarting the Docker daemon and containers afterward might help [2].

These solutions focus on ensuring the sandbox service is correctly configured and can resolve network names. You might want to check your docker-compose.yaml and DNS settings as described.

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] avatar Mar 12 '25 02:03 dosubot[bot]

Python code that worked fine on the previous version of Dify will fail after the upgrade

xiaoyesoso avatar Mar 12 '25 02:03 xiaoyesoso

Turn off the proxy and try it again.

crazywoola avatar Mar 12 '25 02:03 crazywoola

My javascript code that worked fine on the previous version of Dify will fail after the upgrade to 1.0.1

ensleep avatar Mar 12 '25 09:03 ensleep

Turn off the proxy and try it again.

I restart docker-compose(down and up). It does not work.

ensleep avatar Mar 12 '25 12:03 ensleep

检查一下,是不是volumes里面没有这个文件,需要从github下载手工放进去。 https://github.com/langgenius/dify/blob/main/docker/volumes/sandbox/conf/config.yaml

ensleep avatar Mar 13 '25 14:03 ensleep

检查一下,是不是volumes里面没有这个文件,需要从github下载手工放进去。 https://github.com/langgenius/dify/blob/main/docker/volumes/sandbox/conf/config.yaml

This is useful to me! But I hope the official can give clear instructions when upgrading Docker.

xiaoyesoso avatar Mar 14 '25 06:03 xiaoyesoso

检查一下,是不是volumes里面没有这个文件,需要从github下载手工放进去。 https://github.com/langgenius/dify/blob/main/docker/volumes/sandbox/conf/config.yaml

this is useful to me to solve my problem, thanks

UncleLLD avatar Apr 24 '25 08:04 UncleLLD

检查一下,是不是volumes里面没有这个文件,需要从github下载手工放进去。 https://github.com/langgenius/dify/blob/main/docker/volumes/sandbox/conf/config.yaml

This is useful for me! I have the same problem. Very Good! But I think It will be better if the official gives the default config information or gives the clear instruction info

SpencerKD avatar Aug 12 '25 08:08 SpencerKD