Skip to content

[Bug]: Internal MCP self-connection fails with "405 Method Not Allowed" on rootless Podman (blocks all conversations) #4493

Description

@patmansk

Operating System

Linux

Installation Method

Other

Agent Canvas Version

ghcr.io/openhands/openhands:latest (SDK v1.36.0)

Bug Description

Is there an existing issue for the same bug?
I have searched existing issues and this is not a duplicate.
Related: OpenHands/OpenHands#13861 (closed as stale, not fixed) and OpenHands/OpenHands#16201 (same underlying code path, different symptom — SSL record layer failure instead of 405)

Installation Method

Podman (rootless, user-scoped, via Quadlet) — main app container + dynamically created oh-agent-server-* sandbox containers

Bug Description

Every new conversation fails as soon as a message is sent. The internal MCP client inside the dynamically created oh-agent-server-* sandbox container tries to connect to OpenHands' own built-in MCP endpoint and fails with 405 Method Not Allowed. This happens even with mcp_config: {} (no user-configured MCP servers) and blocks the agent from responding at all — not a cosmetic warning.

What I've tried
Confirmed host.docker.internal resolves correctly from the sandbox container (this is not a DNS issue — unlike the LAN-IP case in OpenHands/OpenHands#16201, my WEB_HOST defaults to localhost/host.docker.internal).
Setting Environment=WEB_HOST=host.docker.internal:3000 (no scheme) → changes the failure mode to httpx.ConnectError: [SSL] record layer failure (_ssl.c:1032) — the internal MCP client apparently now attempts HTTPS against a plain-HTTP port. Same underlying issue as OpenHands/OpenHands#16201.
Setting Environment=WEB_HOST=http://host.docker.internal:3000 (explicit scheme) → still fails, "MCP Connection Failure" (same SSL error).
Removing WEB_HOST entirely → back to the original 405.

None of these env var combinations fix it. This strongly suggests the bug is in how the agent-server derives/uses the internal MCP server URL (meta.json / mcp_oauth_store.py) rather than something fixable purely via environment configuration — consistent with the root cause described in OpenHands/OpenHands#13861.

Impact
OpenHands is completely unusable for chat/conversations in this deployment (rootless Podman, Quadlet, sandbox containers created dynamically via the Docker-compatible socket API). This is not an edge case — it reproduces on every single new conversation and every message.
Environment details
Host: Linux (Nobara 44, Fedora-based), Podman 5.8.4 rootless (user-scoped systemd Quadlet units)
Main container: ghcr.io/openhands/openhands:latest
Sandbox container: ghcr.io/openhands/agent-server:1.36.0-python
mcp_config: empty / default (no user-configured MCP servers)
LLM: local Ollama backend (qwen3-coder:30b) — confirmed unrelated to the bug, error occurs before any LLM call

Steps to Reproduce

Run OpenHands via rootless Podman (Quadlet), main container joined to a pod, with the Docker socket mounted for dynamic sandbox creation:
Volume=/run/user/1000/podman/podman.sock:/var/run/docker.sock:rw
Start a new conversation.
Send any message, e.g. "Hallo".
Observe the UI error:
Client error '405 Method Not Allowed' for url 'http://host.docker.internal:3000/mcp/mcp'

Actual Behavior

Every message send attempt in every new conversation fails immediately with MCPError: MCP Connection Failure or the underlying 405/SSL error, regardless of the configured LLM/model. The conversation is unusable.

Expected Behavior

Sending a message should not depend on a successful connection to the internally-registered "default" MCP server if it's not needed / not configured by the user.
At minimum, the built-in self-MCP-connection should not throw an unhandled error that aborts _ensure_agent_ready and prevents any response from being generated.

Relevant Logs

Error / Traceback
Traceback (most recent call last):
  File "openhands/agent_server/sockets.py", line 351, in events_socket
  File "openhands/agent_server/event_service.py", line 499, in send_message
  ...
  File "openhands/sdk/conversation/impl/local_conversation.py", line 1365, in _ensure_agent_ready
  File "openhands/sdk/conversation/impl/local_conversation.py", line 1201, in _runtime_mcp_tools_for_agent
  File "openhands/sdk/conversation/impl/local_conversation.py", line 1193, in _runtime_mcp_tools
  File "openhands/agent_server/mcp_oauth_store.py", line 334, in create_tools
  File "openhands/sdk/mcp/client.py", line 97, in sync_close
  ...
  File "mcp/client/streamable_http.py", line 358, in _handle_post_request
  File "httpx/_models.py", line 829, in raise_for_status
httpx.HTTPStatusError: Client error '405 Method Not Allowed' for url 'http://host.docker.internal:3000/mcp/mcp'

Additional related failures in the same logs (webhook posts, also 405, also to the main container):

Conversation webhook post attempt 4 failed: Client error '405 Method Not Allowed' for url 'http://host.docker.internal:3000/api/v1/webhooks/conversations'
Failed to post events to webhook http://host.docker.internal:3000/api/v1/webhooks/events/<id> after 4 attempts

Screenshots

No response

Additional Context

This looks like the same root cause as OpenHands/OpenHands#13861 (internal MCP URL / meta.json not reflecting the correct web_url) and OpenHands/OpenHands#16201 (SSL failure when WEB_HOST is set to a non-default value). OpenHands/OpenHands#13861 was auto-closed as stale without a fix being merged. OpenHands/OpenHands#16201 was closed by the reporter as "completed" but without any comment explaining the resolution, so it's unclear whether an actual code fix was applied or merged.

Given three independent reports hitting the same code path (mcp_oauth_store.py → _runtime_mcp_tools) with different symptoms depending on network/WEB_HOST configuration, I'd like to request that this be reopened/tracked as a confirmed bug rather than closed without a resolution being documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdockermcppriority:highFor bugs, affecting nearly all users and degrading performance or UX.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions