E2BInternetAccessError
e2b.exceptions.E2BInternetAccessError
Stack trace
Traceback (most recent call last):
File "app.py", line 42, in <module>
response = e2b_client.call_api(payload)
File "/usr/local/lib/python3.9/site-packages/e2b/client.py", line 88, in call_api
raise E2BInternetAccessError("Internet access not available")
e2b.exceptions.E2BInternetAccessError: Internet access not available Why it happens
The E2B client requires internet connectivity to reach external APIs. This error occurs when the runtime environment blocks outbound network requests due to firewall rules, missing proxy configuration, or disabled network interfaces. Without internet access, the client cannot complete API calls.
Detection
Monitor network connectivity before making E2B API calls by pinging a known endpoint or catching E2BInternetAccessError exceptions to log and alert on connectivity issues.
Causes & fixes
Firewall or network policy blocks outbound internet access
Configure firewall rules or network policies to allow outbound HTTPS traffic to E2B API endpoints.
Missing or incorrect proxy settings in environment
Set the appropriate HTTP_PROXY and HTTPS_PROXY environment variables to enable internet access through your proxy.
Running in an isolated environment without network access (e.g., local sandbox or restricted container)
Enable network access for the container or sandbox, or run the code in an environment with internet connectivity.
Code: broken vs fixed
from e2b import E2BClient
client = E2BClient()
response = client.call_api({'query': 'test'}) # Raises E2BInternetAccessError here import os
from e2b import E2BClient
# Set proxy environment variables if behind a proxy
os.environ['HTTP_PROXY'] = 'http://proxy.example.com:8080'
os.environ['HTTPS_PROXY'] = 'http://proxy.example.com:8080'
client = E2BClient()
response = client.call_api({'query': 'test'}) # Fixed: environment allows internet access
print(response) Workaround
Catch E2BInternetAccessError and fallback to cached responses or local mocks to allow partial functionality without internet.
Prevention
Deploy your application in environments with guaranteed outbound internet access or properly configured proxies, and add pre-flight connectivity checks before E2B calls.