iflytek/astron-agent · error · RuntimeError

Sandbox runtime configuration is unavailable

Error message

Sandbox runtime configuration is unavailable

What it means

_load_runtime_config_url validates the sandbox runtime-config URL the same way (parseable URL, no query/fragment, valid port). Failures raise RuntimeError(SANDBOX_RUNTIME_CONFIG_ERROR), meaning the E2B runtime configuration endpoint is not usable, which blocks sandbox creation via _fetch_e2b_runtime_config.

Solutions

  1. Set the runtime config URL env var to a clean absolute URL (no query/fragment) with a valid port.
  2. Cross-check against the deployed sandbox runtime-config service address.
  3. Redeploy/restart the workflow service after fixing the env so the value is picked up.

Example fix

// before
RUNTIME_CONFIG_URL=https://cfg.internal:8443?env=prod
// after
RUNTIME_CONFIG_URL=https://cfg.internal:8443
Defensive patterns

Strategy: validation

Validate before calling

from urllib.parse import urlparse
u = urlparse(os.environ.get("RUNTIME_CONFIG_URL", ""))
assert u.scheme in ("http", "https") and u.netloc and not u.query and not u.fragment, "bad runtime config URL"
_ = u.port

Try / catch

try:
    sandbox = ex.create(...)
except RuntimeError as e:
    if "runtime configuration" in str(e): surface deployment misconfiguration; do not retry blindly

Prevention

When it happens

Trigger: RUNTIME_CONFIG_URL_ENV unset/empty or malformed (bad port, query string, fragment) when _create_e2b_sandbox triggers _fetch_e2b_runtime_config.

Common situations: Deployment env missing the runtime-config URL, typo in scheme/host, port range typo (e.g. :99999), URL copied with '#fragment' anchor.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/9859dd95c26a288e. Report an issue: GitHub.

Appendix: source

Thrown at core/workflow/engine/nodes/code/executor/e2b/e2b_executor.py:204

    runtime_config_url = (os.getenv(RUNTIME_CONFIG_URL_ENV) or "").strip()
    try:
        parsed = urlsplit(runtime_config_url)
        if (
            not runtime_config_url
            or len(runtime_config_url) > 2048
            or any(char in runtime_config_url for char in ("\r", "\n", "\t"))
            or parsed.scheme not in {"http", "https"}
            or not parsed.hostname
            or parsed.username is not None
            or parsed.password is not None
            or parsed.path != RUNTIME_CONFIG_PATH
            or bool(parsed.query)
            or bool(parsed.fragment)
        ):
            raise ValueError
        parsed.port
    except (TypeError, ValueError):
        raise RuntimeError(SANDBOX_RUNTIME_CONFIG_ERROR) from None
    return runtime_config_url


def _load_runtime_credential_token() -> str:
    token = (os.getenv(RUNTIME_CREDENTIAL_TOKEN_ENV) or "").strip()
    if not token:
        token_file = (os.getenv(RUNTIME_CREDENTIAL_TOKEN_FILE_ENV) or "").strip()
        if token_file:
            try:
                token = Path(token_file).read_text(encoding="utf-8").strip()
            except (OSError, UnicodeError):
                raise RuntimeError(SANDBOX_RUNTIME_CONFIG_ERROR) from None
    if (
        len(token) < MIN_RUNTIME_CREDENTIAL_TOKEN_LENGTH
        or "\r" in token
        or "\n" in token
    ):
        raise RuntimeError(SANDBOX_RUNTIME_CONFIG_ERROR)

View on GitHub (pinned to 5e758547a8)