FoundationAgents/OpenManus · error · RuntimeError

Failed to create session: {str(e)}

Error message

Failed to create session: {str(e)}

What it means

Error "Failed to create session: {str(e)}" thrown in FoundationAgents/OpenManus.

Source

Thrown at app/tool/sandbox/sb_shell_tool.py:101

    def __init__(
        self, sandbox: Optional[Sandbox] = None, thread_id: Optional[str] = None, **data
    ):
        """Initialize with optional sandbox and thread_id."""
        super().__init__(**data)
        if sandbox is not None:
            self._sandbox = sandbox

    async def _ensure_session(self, session_name: str = "default") -> str:
        """Ensure a session exists and return its ID."""
        if session_name not in self._sessions:
            session_id = str(uuid4())
            try:
                await self._ensure_sandbox()  # Ensure sandbox is initialized
                self.sandbox.process.create_session(session_id)
                self._sessions[session_name] = session_id
            except Exception as e:
                raise RuntimeError(f"Failed to create session: {str(e)}")
        return self._sessions[session_name]

    async def _cleanup_session(self, session_name: str):
        """Clean up a session if it exists."""
        if session_name in self._sessions:
            try:
                await self._ensure_sandbox()  # Ensure sandbox is initialized
                self.sandbox.process.delete_session(self._sessions[session_name])
                del self._sessions[session_name]
            except Exception as e:
                print(f"Warning: Failed to cleanup session {session_name}: {str(e)}")

    async def _execute_raw_command(self, command: str) -> Dict[str, Any]:
        """Execute a raw command directly in the sandbox."""
        # Ensure session exists for raw commands
        session_id = await self._ensure_session("raw_commands")

        # Execute command in session

View on GitHub (pinned to 52a13f2a57)

Solutions

  1. Check that the sandbox is initialized and reachable before creating a session; the underlying exception is included in the message.
  2. Verify sandbox resource limits have not been hit (max sandboxes, Docker image availability) and retry.

When it happens

Trigger: 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.

Common situations: See trigger scenarios.


AI-assisted analysis of FoundationAgents/OpenManus@52a13f2a57 (2026-08-15). Data as JSON: /api/errors/bbda4a78a5565dfe. Report an issue: GitHub.