{"record":{"id":"4b2826b5c6b8e5c2","repo":"langchain-ai/deepagents","slug":"failed-to-create-runloop-devbox-from-target","errorCode":null,"errorMessage":"Failed to create Runloop devbox from '{target}': {e}","messagePattern":"Failed to create Runloop devbox from '(.+?)': (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/partners/runloop/langchain_runloop/provider.py","lineNumber":220,"sourceCode":"                    blueprint_id=env_blueprint_id,\n                    blueprint_name=blueprint_name,\n                    dockerfile=dockerfile,\n                )\n            else:\n                devbox = self._sdk.devbox.create()\n        except (AuthenticationError, PermissionDeniedError) as e:\n            msg = (\n                \"Runloop rejected the credentials; check RUNLOOP_API_KEY \"\n                f\"(or DEEPAGENTS_CODE_RUNLOOP_API_KEY): {e}\"\n            )\n            raise RuntimeError(msg) from e\n        except (APIConnectionError, APITimeoutError) as e:\n            msg = f\"Runloop API unreachable (transient — safe to retry): {e}\"\n            raise RuntimeError(msg) from e\n        except Exception as e:\n            target = blueprint_name or env_blueprint_id or \"devbox\"\n            msg = f\"Failed to create Runloop devbox from '{target}': {e}\"\n            raise RuntimeError(msg) from e\n\n        return RunloopSandbox(devbox=devbox)\n\n    def _create_from_blueprint(\n        self,\n        *,\n        blueprint_id: str | None,\n        blueprint_name: str | None,\n        dockerfile: str,\n    ) -> Devbox:\n        if blueprint_id is not None:\n            return self._sdk.devbox.create_from_blueprint_id(blueprint_id)\n        if blueprint_name is None:\n            msg = \"Blueprint name is required when no blueprint ID is set\"\n            raise RuntimeError(msg)\n        _ensure_blueprint(self._client, blueprint_name, dockerfile=dockerfile)\n        return self._sdk.devbox.create_from_blueprint_name(blueprint_name)\n","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/partners/runloop/langchain_runloop/provider.py#L202-L238","documentation":"The catch-all in `get_or_create`: any exception from devbox creation or blueprint boot that is not auth-, permission-, connection-, or timeout-related is re-raised as a `RuntimeError` naming the creation target — the blueprint name, blueprint ID, or literally `'devbox'` for a plain create. It wraps underlying SDK/API errors so callers only need to handle `RuntimeError`, while the original exception is preserved via `raise ... from`.","triggerScenarios":"`get_or_create` create path where the Runloop SDK raises anything else — e.g. `create_from_blueprint_id` with a nonexistent/invalid blueprint ID, quota/capacity errors (4xx/5xx responses), rate limiting, or an invalid blueprint name rejected by the API.","commonSituations":"`RUNLOOP_SANDBOX_BLUEPRINT_ID` pointing at a deleted blueprint; org quota exhausted for concurrent devboxes; API returning 500s or 429s; malformed snapshot/blueprint name characters.","solutions":["Inspect `e.__cause__` (or the embedded message) for the underlying API error and status code.","If the cause is 429/quota, delete unused devboxes (`provider.delete(sandbox_id=...)`) or wait, then retry.","If the cause mentions the blueprint ID, verify `RUNLOOP_SANDBOX_BLUEPRINT_ID` in the Runloop dashboard; fall back to name-based `snapshot=`.","If transient (5xx), retry with backoff.","Simplify to `provider.get_or_create()` (empty devbox) to isolate whether the blueprint path is the problem."],"exampleFix":"// before\nsandbox = provider.get_or_create()  # RuntimeError: Failed to create Runloop devbox from 'devbox': 429\n\n// after\ntry:\n    sandbox = provider.get_or_create()\nexcept RuntimeError as e:\n    if \"429\" in str(e):\n        for old in provider.list_sandboxes():  # free quota\n            provider.delete(sandbox_id=old.id)\n        sandbox = provider.get_or_create()\n    else:\n        raise","handlingStrategy":"try-catch","validationCode":"def blueprint_id_env_valid(value: str | None) -> bool:\n    return bool(value) and value.startswith(\"bp_\")  # adjust to real ID prefix","typeGuard":null,"tryCatchPattern":"try:\n    sandbox = provider.get_or_create(snapshot=\"my-bp\")\nexcept RuntimeError as e:\n    cause = e.__cause__\n    if cause is not None and \"429\" in str(cause):\n        backoff_and_retry()\n    else:\n        log.error(\"devbox creation from %s failed: %s\", e, cause)\n        raise","preventionTips":["Always inspect `e.__cause__` for the underlying API status before deciding to retry or abort.","Verify blueprint IDs/names in the Runloop dashboard before setting `RUNLOOP_SANDBOX_BLUEPRINT_*`.","Watch org devbox quotas; delete finished devboxes (`provider.delete(sandbox_id=...)`).","Log the wrapped message (it names the target: blueprint name, ID, or 'devbox') for fast triage."],"tags":["runloop","devbox","api-error","rate-limit"],"backgroundTag":"devbox-creation-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}