{"record":{"id":"bbda4a78a5565dfe","repo":"FoundationAgents/OpenManus","slug":"failed-to-create-session-str-e","errorCode":null,"errorMessage":"Failed to create session: {str(e)}","messagePattern":"Failed to create session: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"app/tool/sandbox/sb_shell_tool.py","lineNumber":101,"sourceCode":"\n    def __init__(\n        self, sandbox: Optional[Sandbox] = None, thread_id: Optional[str] = None, **data\n    ):\n        \"\"\"Initialize with optional sandbox and thread_id.\"\"\"\n        super().__init__(**data)\n        if sandbox is not None:\n            self._sandbox = sandbox\n\n    async def _ensure_session(self, session_name: str = \"default\") -> str:\n        \"\"\"Ensure a session exists and return its ID.\"\"\"\n        if session_name not in self._sessions:\n            session_id = str(uuid4())\n            try:\n                await self._ensure_sandbox()  # Ensure sandbox is initialized\n                self.sandbox.process.create_session(session_id)\n                self._sessions[session_name] = session_id\n            except Exception as e:\n                raise RuntimeError(f\"Failed to create session: {str(e)}\")\n        return self._sessions[session_name]\n\n    async def _cleanup_session(self, session_name: str):\n        \"\"\"Clean up a session if it exists.\"\"\"\n        if session_name in self._sessions:\n            try:\n                await self._ensure_sandbox()  # Ensure sandbox is initialized\n                self.sandbox.process.delete_session(self._sessions[session_name])\n                del self._sessions[session_name]\n            except Exception as e:\n                print(f\"Warning: Failed to cleanup session {session_name}: {str(e)}\")\n\n    async def _execute_raw_command(self, command: str) -> Dict[str, Any]:\n        \"\"\"Execute a raw command directly in the sandbox.\"\"\"\n        # Ensure session exists for raw commands\n        session_id = await self._ensure_session(\"raw_commands\")\n\n        # Execute command in session","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/sandbox/sb_shell_tool.py#L83-L119","documentation":"Error \"Failed to create session: {str(e)}\" thrown in FoundationAgents/OpenManus.","triggerScenarios":"Raised when the sandbox shell tool fails to create a new terminal session, e.g. the sandbox is unreachable, not initialized, or the session request errors.","commonSituations":"See trigger scenarios.","solutions":["Check that the sandbox is initialized and reachable before creating a session; the underlying exception is included in the message.","Verify sandbox resource limits have not been hit (max sandboxes, Docker image availability) and retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"52a13f2a57d8c7f6737eefb02ccf569594d44273","analyzedAt":"2026-08-15T02:33:49.993Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}