{"record":{"id":"48fd07835b7e8387","repo":"FoundationAgents/OpenManus","slug":"failed-to-create-sandbox-e","errorCode":null,"errorMessage":"Failed to create sandbox: {e}","messagePattern":"Failed to create sandbox: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"app/sandbox/core/manager.py","lineNumber":157,"sourceCode":"                raise RuntimeError(f\"Failed to ensure Docker image: {config.image}\")\n\n            sandbox_id = str(uuid.uuid4())\n            try:\n                sandbox = DockerSandbox(config, volume_bindings)\n                await sandbox.create()\n\n                self._sandboxes[sandbox_id] = sandbox\n                self._last_used[sandbox_id] = asyncio.get_event_loop().time()\n                self._locks[sandbox_id] = asyncio.Lock()\n\n                logger.info(f\"Created sandbox {sandbox_id}\")\n                return sandbox_id\n\n            except Exception as e:\n                logger.error(f\"Failed to create sandbox: {e}\")\n                if sandbox_id in self._sandboxes:\n                    await self.delete_sandbox(sandbox_id)\n                raise RuntimeError(f\"Failed to create sandbox: {e}\")\n\n    async def get_sandbox(self, sandbox_id: str) -> DockerSandbox:\n        \"\"\"Gets a sandbox instance.\n\n        Args:\n            sandbox_id: Sandbox ID.\n\n        Returns:\n            DockerSandbox: Sandbox instance.\n\n        Raises:\n            KeyError: If sandbox does not exist.\n        \"\"\"\n        async with self.sandbox_operation(sandbox_id) as sandbox:\n            return sandbox\n\n    def start_cleanup_task(self) -> None:\n        \"\"\"Starts automatic cleanup task.\"\"\"","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/sandbox/core/manager.py#L139-L175","documentation":"Catch-all failure of SandboxManager.create_sandbox (app/sandbox/core/manager.py:157): any exception raised while constructing DockerSandbox or running sandbox.create() is logged, the partially registered sandbox is deleted via delete_sandbox to avoid a leak, and a RuntimeError wrapping the original message is re-raised. The original cause is in {e} — read it, not this wrapper.","triggerScenarios":"docker.containers.run failing (name/port/volume conflict, image removed concurrently, resource exhaustion like out-of-memory or no available IP in the docker network); terminal exec creation failing inside sandbox.create(); invalid volume_bindings pointing at non-existent host dirs.","commonSituations":"Two sandboxes binding the same host port; host directory for a volume binding not created; Docker daemon out of resources after many sandboxes; leftover containers with a generated name colliding.","solutions":["Inspect the {e} text — it carries the underlying docker error (port conflict, volume error, OCI runtime error).","Check `docker ps -a` and `docker events` around the failure for the container-level cause.","Validate volume_bindings host paths exist and are writable before creating.","Free Docker resources (prune stopped containers/networks) and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    sid = await manager.create_sandbox(config, volume_bindings)\nexcept RuntimeError as e:\n    log.error(\"sandbox create failed: %s\", e.__cause__ or e)\n    raise  # manager already cleaned up the partial sandbox","preventionTips":["Validate volume-binding host paths exist before creating","Avoid fixed host port bindings across sandboxes","Treat {e} text as the real cause — this is only a wrapper","Monitor docker events for the underlying container error"],"tags":["docker","sandbox","wrapper-exception","cleanup","container-create"],"backgroundTag":null,"analyzedSha":"52a13f2a57d8c7f6737eefb02ccf569594d44273","analyzedAt":"2026-08-15T02:33:49.993Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}