Skip to content

[Bug] OpenAPI upstream timeouts are masked instead of mapped to the actionable timeout message #5846

Closed

Description

@BlueX888

What happened?

With mask_error_details=True on FastMCP 3.x, an upstream OpenAPI timeout returns Error calling tool 'slow' instead of Upstream request timed out, please retry.

The 4.x fix is merged in #5847; this issue remains for 3.x as tracked in #6167.

Example Code

import asyncio
import httpx
from fastmcp import Client, FastMCP

SPEC = {
    "openapi": "3.1.0",
    "info": {"title": "Timeout example", "version": "1.0"},
    "paths": {"/slow": {"get": {
        "operationId": "slow",
        "responses": {"200": {"description": "OK"}},
    }}},
}

def timeout(request: httpx.Request) -> httpx.Response:
    raise httpx.ReadTimeout("upstream timed out", request=request)

async def main() -> None:
    async with httpx.AsyncClient(
        base_url="https://example.test",
        transport=httpx.MockTransport(timeout),
    ) as upstream:
        server = FastMCP.from_openapi(
            SPEC, client=upstream, mask_error_details=True
        )
        async with Client(server) as client:
            result = await client.call_tool("slow", {}, raise_on_error=False)
            print(result.content[0].text)

asyncio.run(main())

Output: Error calling tool 'slow'.

Version Information

Reproduced on release/3.x at 9dc7191c1b44291be05c7d7bcf4cb3c18d86c434 with native httpx 0.28.1.

FastMCP version: 3.4.11
MCP version: 1.26.0
Python version: 3.12.2
Platform: Windows-11-10.0.26200-SP0

Prepared and reproduced with Codex.

Activity

  1. added
    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.
    openapiRelated to OpenAPI integration, parsing, or code generation features.
    too-longExcessively verbose or unedited LLM output. Condense before triage.
    on Oct 19, 2026
  2. marvin-context-protocol commented on Oct 19, 2026

    @marvin-context-protocol
    Contributor

    Thanks for the report. This issue goes beyond what our contributor guidelines ask for — we just need a short problem description and an MRE. Please see our contributing guidelines and condense this issue. We'll triage it once it's trimmed down.

  3. zzstoatzz commented on Nov 11, 2026

    @zzstoatzz
    Collaborator

    Fixed on main by #5847; the 3.x backport is #6432.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.openapiRelated to OpenAPI integration, parsing, or code generation features.too-longExcessively verbose or unedited LLM output. Condense before triage.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions