FoundationAgents/OpenManus · error · ValueError

Command is required for stdio connection

Error message

Command is required for stdio connection

What it means

Raised by MCPSelfCorruptAgent.initialize() when connection_type is "stdio" but the command argument is empty/None. The stdio transport needs an executable to spawn the MCP server locally; without it there is nothing to run. Note args defaults to [] so only command is mandatory.

Source

Thrown at app/agent/mcp.py:65

        """Initialize the MCP connection.

        Args:
            connection_type: Type of connection to use ("stdio" or "sse")
            server_url: URL of the MCP server (for SSE connection)
            command: Command to run (for stdio connection)
            args: Arguments for the command (for stdio connection)
        """
        if connection_type:
            self.connection_type = connection_type

        # Connect to the MCP server based on connection type
        if self.connection_type == "sse":
            if not server_url:
                raise ValueError("Server URL is required for SSE connection")
            await self.mcp_clients.connect_sse(server_url=server_url)
        elif self.connection_type == "stdio":
            if not command:
                raise ValueError("Command is required for stdio connection")
            await self.mcp_clients.connect_stdio(command=command, args=args or [])
        else:
            raise ValueError(f"Unsupported connection type: {self.connection_type}")

        # Set available_tools to our MCP instance
        self.available_tools = self.mcp_clients

        # Store initial tool schemas
        await self._refresh_tools()

        # Add system message about available tools
        tool_names = list(self.mcp_clients.tool_map.keys())
        tools_info = ", ".join(tool_names)

        # Add system prompt and available tools information
        self.memory.add_message(
            Message.system_message(
                f"{self.system_prompt}\n\nAvailable MCP tools: {tools_info}"

View on GitHub (pinned to 52a13f2a57)

Solutions

  1. Pass a valid command, e.g. await agent.initialize(connection_type="stdio", command="npx", args=["-y", "@modelcontextprotocol/server-filesystem", "/tmp"])
  2. Validate config: ensure server_config["command"] is present when type == "stdio" before constructing the agent
  3. Switch to connection_type="sse" with server_url if the server is remote

Example fix

// before
await agent.initialize(connection_type="stdio", args=["-y", "server-pkg"])

// after
await agent.initialize(connection_type="stdio", command="npx", args=["-y", "server-pkg"])
Defensive patterns

Strategy: validation

Validate before calling

def valid_stdio_params(connection_type: str, command: str | None) -> bool:
    return connection_type == "stdio" and bool(command and command.strip())

Prevention

When it happens

Trigger: Calling initialize(connection_type="stdio") with no command, or initialize(connection_type="stdio", command="") or command=None. Also happens when a stored connection_type of "stdio" persists and a later initialize() call omits command.

Common situations: Config entry mcpServers.<id> has type="stdio" but command key missing; typo like "cmd" or "executable" instead of "command"; assuming the agent remembers the command from a prior call.

Related errors


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