{"record":{"id":"e7fb88cd199defa6","repo":"BerriAI/litellm","slug":"opensandbox-sandbox-sandbox-id-entered-state","errorCode":null,"errorMessage":"OpenSandbox sandbox {sandbox_id} entered {state}","messagePattern":"OpenSandbox sandbox (.+?) entered (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/opensandbox/sandbox/transformation.py","lineNumber":260,"sourceCode":"        client: AsyncHTTPHandler | None,\n        ready_timeout: float,\n        poll_interval: float,\n    ) -> None:\n        deadline: Final = time.monotonic() + ready_timeout\n        while True:\n            response = cast(\n                httpx.Response,\n                await self._http(client).get(\n                    url=f\"{api_base}/sandboxes/{sandbox_id}\",\n                    headers=headers,\n                ),\n            )\n            data = response.json()\n            state = self._sandbox_state(data)\n            if state == \"Running\":\n                return\n            if state in {\"Failed\", \"Stopping\", \"Terminated\"}:\n                raise ValueError(f\"OpenSandbox sandbox {sandbox_id} entered {state}\")\n            if time.monotonic() >= deadline:\n                raise TimeoutError(f\"OpenSandbox sandbox {sandbox_id} was not Running within {ready_timeout} seconds\")\n            await asyncio.sleep(poll_interval)\n\n    async def _wait_for_execd_endpoint(\n        self,\n        *,\n        sandbox_id: str,\n        api_base: str,\n        headers: dict[str, str],\n        use_server_proxy: bool,\n        client: AsyncHTTPHandler | None,\n        ready_timeout: float,\n        poll_interval: float,\n    ) -> tuple[str, dict[str, str]]:\n        deadline: Final = time.monotonic() + ready_timeout\n        last_error: Exception | None = None\n        while True:","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/opensandbox/sandbox/transformation.py#L242-L278","documentation":"While waiting for an OpenSandbox sandbox to boot, LiteLLM polls GET {api_base}/sandboxes/{id} and inspects the state field. If the state becomes Failed, Stopping, or Terminated, it raises ValueError immediately: the sandbox can never reach Running, so waiting longer or retrying the wait is pointless. A new sandbox must be created.","triggerScenarios":"Creating an OpenSandbox sandbox via litellm (code execution tooling) with an invalid image, unsupported resources, expired/invalid lifecycle API key, or a provider-side crash - the poll loop then observes a terminal state instead of Running.","commonSituations":"Typo'd or unavailable sandbox image name; quota/permission issues on the OpenSandbox account surfacing as async creation failure; provider incidents marking sandboxes Failed during provisioning.","solutions":["Query GET {api_base}/sandboxes/{id} with the same lifecycle headers to read the full sandbox record and failure reason","Verify the image name and resource options passed to the create call","Delete the dead sandbox and recreate with corrected parameters - terminal states are unrecoverable","Confirm the lifecycle API key and api_base are valid for the account"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"Wrap create-and-wait in try/except ValueError; when the message contains 'entered Failed', 'Stopping', or 'Terminated', delete the dead sandbox, recreate with corrected parameters (image/resources/key), and if creation keeps failing, fall back to a different sandbox provider - never re-wait on a terminal sandbox.","preventionTips":["Validate image names and resource options against provider docs before create","Treat terminal states as unrecoverable: recreate, do not extend the wait","Log sandbox IDs and states so recurring creation failures are traceable to a cause"],"tags":["opensandbox","sandbox","lifecycle","provisioning","litellm"],"backgroundTag":"resource-provisioning-failed","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}