The sandbox was not found
I opened an e2b sandbox, successfully wrote a file, and set the timeout to one day. However, after a few minutes, when I tried to call the shell again, it returned an error saying the sandbox didn't exist. My account is a pro account. How can I fix this? I am using the Python SDK, and the error is e2b.exceptions.TimeoutException: The sandbox was not found: This error is likely due to sandbox timeout. You can modify the sandbox timeout by passing 'timeout' when starting the sandbox or calling '.set_timeout' on the sandbox with the desired timeout.
Note: The sandbox uses our custom template and the memory and CPU have been modified to 2 cores and 2 GB. This "sandbox not found" issue is not a consistent one; it happens sometimes but not always. The API service seems to be quite unstable. Is there a way to solve this?
Hi @ytongshang,
Are you using E2B Cloud or a self-hosted setup? If you’re on E2B Cloud, could you share the affected sandbox ID so I can check what happened. I would recommend using our support email for such cases.
Also, can you describe the issues you’re seeing with the API?
Hi,
Thanks for the quick reply. We are using E2B Cloud, and here are two affected sandbox IDs:
Sandbox ID: ievtilajra92y0ryeiwnz, Template: 0p2vvsdyywf6qwx90k4r
Sandbox ID: iwvbky7pxrd0frok0xzi8, Template: 0p2vvsdyywf6qwx90k4r
We've also been seeing issues with the Python SDK. Specifically, we've found that the timeout parameter in the Sandbox.create() method doesn't seem to work as intended; it appears we have to manually call sbx.set_timeout() afterward.
Additionally, we're finding that even with the set_timeout() method, the sandbox becomes unavailable after a short period. Here's a snippet of the code we're using:
# The timeout parameter in create is not working
sbx = Sandbox.create(
template=self.e2b_template,
timeout=3 * 60,
allow_internet_access=True,
request_timeout=600,
api_key=self.api_key,
)
# The timeout in set_timeout is working
sbx.set_timeout(self.timeout)