FoundationAgents/OpenManus · error · ValueError

Unsupported connection type: {self.connection_type}

Error message

Unsupported connection type: {self.connection_type}

What it means

Raised by MCPSelfCorruptAgent.initialize() when self.connection_type is neither "sse" nor "stdio". Because initialize() only overwrites self.connection_type when the argument is truthy, a stale or misspelled stored value (e.g. "SSE", "http", "") also lands here. The message interpolates the offending value so you can see exactly what was rejected.

Source

Thrown at app/agent/mcp.py:68

            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. Set connection_type to exactly "sse" or "stdio" (lowercase)
  2. Normalize/validate the value in your config loader before passing it in (strip whitespace, lower())
  3. If you need another transport, upgrade the library or extend this initialize() branch to handle it

Example fix

// before
await agent.initialize(connection_type="SSE", server_url=url)  # Unsupported connection type: SSE

// after
await agent.initialize(connection_type="sse", server_url=url)
Defensive patterns

Strategy: type-guard

Validate before calling

SUPPORTED_CONNECTION_TYPES = {"sse", "stdio"}

def is_supported_connection_type(t: str | None) -> bool:
    return isinstance(t, str) and t.strip().lower() in SUPPORTED_CONNECTION_TYPES

Type guard

from typing import TypeGuard

SUPPORTED = {"sse", "stdio"}

def is_connection_type(value: object) -> TypeGuard[str]:
    return isinstance(value, str) and value in SUPPORTED

Try / catch

try:
    await agent.initialize(connection_type=ctype, server_url=url, command=cmd)
except ValueError as e:
    if "Unsupported connection type" in str(e):
        logger.error("Bad MCP transport %r; supported: sse, stdio", ctype)
        raise SystemExit(2) from e
    raise

Prevention

When it happens

Trigger: initialize(connection_type="websocket"), connection_type="SSE" (case-sensitive), or calling initialize() with no arguments after constructing the agent with a default/invalid connection_type. Any leftover self.connection_type set to something other than the two literals triggers it.

Common situations: Newer MCP transports (streamable-http, websocket) not supported by this version; config type field typo like "Stdio" or "sse2"; case mismatch between config value and the literals compared in code.

Related errors


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