{"record":{"id":"ae7b1c427783c34d","repo":"langchain-ai/deepagents","slug":"failed-while-waiting-for-vercel-sandbox-startup","errorCode":null,"errorMessage":"Failed while waiting for Vercel sandbox startup.","messagePattern":"Failed while waiting for Vercel sandbox startup\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/integrations/sandbox_factory.py","lineNumber":1054,"sourceCode":"        if status == \"running\":\n            return\n        if status in _VERCEL_TERMINAL_STATUSES:\n            msg = f\"Vercel sandbox {sandbox.sandbox_id} is in terminal state {status!r}\"\n            raise RuntimeError(msg)\n\n        try:\n            sandbox.wait_for_status(\"running\", timeout=timeout)\n        except TimeoutError as exc:\n            status = str(sandbox.status)\n            msg = (\n                f\"Vercel sandbox {sandbox.sandbox_id} failed to start within \"\n                f\"{timeout} seconds; current status is {status!r}\"\n            )\n            raise RuntimeError(msg) from exc\n        except Exception as exc:  # Vercel SDK exception types vary by version\n            # Generic message avoids leaking credentials; chain preserves cause.\n            msg = \"Failed while waiting for Vercel sandbox startup.\"\n            raise RuntimeError(msg) from exc\n\n\ndef _get_provider(\n    provider_name: str,\n    registry: SandboxRegistry | None = None,\n) -> SandboxProvider:\n    \"\"\"Get a `SandboxProvider` instance for the specified provider (internal).\n\n    Args:\n        provider_name: Name of the provider. Resolved through the registry so\n            built-in, entry-point, and config providers are all supported.\n        registry: An already-built registry to reuse. A fresh one is loaded\n            when omitted.\n\n    Returns:\n        `SandboxProvider` instance. Propagates `ValueError` from the registry\n            if `provider_name` is unknown.\n    \"\"\"","sourceCodeStart":1036,"sourceCodeEnd":1072,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/integrations/sandbox_factory.py#L1036-L1072","documentation":"`_wait_until_running` polls a Vercel sandbox until it reaches the running state; when waiting fails for any reason other than the handled timeout, it raises RuntimeError with this generic message. The wording is deliberately vague to avoid leaking credentials embedded in Vercel SDK exceptions, while `raise ... from exc` preserves the underlying cause for debugging.","triggerScenarios":"Calling `get_or_create` for a Vercel sandbox where the underlying Vercel SDK call inside the wait loop throws — e.g. authentication failure, sandbox id not found, API 5xx, or SDK version-specific exception types.","commonSituations":"Expired or invalid Vercel API token, Vercel service outage or rate limiting, deleted team/project referenced by config, or upgrading the Vercel SDK so exception classes changed shape.","solutions":["Inspect the chained cause: catch the RuntimeError and print/log `__cause__` for the real Vercel error.","Verify the Vercel API token and team/project configuration are valid and unexpired.","Retry `get_or_create` — transient Vercel/network failures during sandbox boot are common.","Pin/check the Vercel SDK version; exception behavior varies between versions."],"exampleFix":"// before\nsandbox = get_or_create('vercel')\n// after\ntry:\n    sandbox = get_or_create('vercel')\nexcept RuntimeError as exc:\n    logger.error('Vercel sandbox startup failed: %s', exc.__cause__)\n    raise","handlingStrategy":"retry","validationCode":"# preflight: confirm token/creds configured before creating sandbox\nimport os\nassert os.environ.get('VERCEL_TOKEN') or vercel_config_token, 'Vercel token missing'","typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        sandbox = get_or_create('vercel')\n        break\n    except RuntimeError as exc:\n        cause = exc.__cause__\n        logger.warning('vercel startup attempt %d failed: %s', attempt, cause)\n        if attempt == 2:\n            raise","preventionTips":["Log exc.__cause__ — the generic message hides the real Vercel error by design","Keep the Vercel SDK token valid and rotate before expiry","Retry transient startup failures with backoff","Pin the Vercel SDK version since exception types vary"],"tags":["python","sandbox","vercel","startup","network"],"backgroundTag":"sandbox-startup-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}