{"record":{"id":"d60e19781ed7ab8d","repo":"PrefectHQ/fastmcp","slug":"request-error-type-exc-name-exc-s","errorCode":null,"errorMessage":"Request error ({type(exc).__name__}): {exc!s}","messagePattern":"Request error \\((.+?)\\): (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/server/providers/openapi/components.py","lineNumber":88,"sourceCode":"        error_message += f\" - {error_data}\"\n    except (json.JSONDecodeError, ValueError):\n        if response.text:\n            error_message += f\" - {response.text}\"\n    raise ValueError(error_message)\n\n\nasync def _send_request(\n    client: httpx2.AsyncClient,\n    request: httpx2.Request,\n) -> httpx2.Response:\n    \"\"\"Send a request while preserving transitional legacy-client errors.\"\"\"\n    try:\n        return await client.send(request)\n    except Exception as exc:\n        if is_timeout_error(exc):\n            raise ValueError(f\"HTTP request timed out ({type(exc).__name__})\") from exc\n        if is_request_error(exc):\n            raise ValueError(f\"Request error ({type(exc).__name__}): {exc!s}\") from exc\n        raise\n\n\ndef _extract_mime_type_from_route(route: HTTPRoute) -> str:\n    \"\"\"Extract the primary MIME type from an HTTPRoute's response definitions.\n\n    Looks for the first successful response (2xx) and returns its content type.\n    Prefers JSON-compatible types when multiple are available.\n    Falls back to \"application/json\" when no response content type is declared.\n    \"\"\"\n    if not route.responses:\n        return _DEFAULT_MIME_TYPE\n\n    # Priority order for success status codes\n    success_codes = [\"200\", \"201\", \"202\", \"204\"]\n\n    response_info = None\n    for status_code in success_codes:","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/server/providers/openapi/components.py#L70-L106","documentation":"Any non-timeout httpx request error (connection refused, DNS failure, TLS errors, too many redirects) raised while sending an OpenAPI proxied request is re-raised as ValueError('Request error (TypeName): details') by _send_request, preserving the original exception as __cause__.","triggerScenarios":"A tool run or resource read where client.send() raises httpx.ConnectError, httpx.ConnectTimeout (non-timeout class), httpx.ProtocolError, etc.","commonSituations":"Backend down or wrong port, DNS misconfiguration, self-signed/invalid TLS certificates, proxy misconfig in the environment.","solutions":["Read the chained exception (raise ... from exc) to see the underlying httpx error","Verify the server URL/host/port in the OpenAPI spec's servers entry","Test connectivity with curl or httpx from the same host","Fix TLS (install CA bundle or use verify= appropriately)"],"exampleFix":"// before\nspec['servers'] = [{'url': 'http://localhost:9999'}]\n// after\nspec['servers'] = [{'url': 'https://api.example.com'}]","handlingStrategy":"try-catch","validationCode":"import httpx\nasync def can_connect(url: str) -> bool:\n    try:\n        async with httpx.AsyncClient() as c:\n            await c.get(url, timeout=5.0)\n        return True\n    except httpx.RequestError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    result = await component.read()\nexcept ValueError as e:\n    if e.__cause__ and not isinstance(e.__cause__, httpx.TimeoutException):\n        log.error('upstream unreachable: %s', e.__cause__)\n    raise","preventionTips":["Health-check the upstream URL at startup","Pin the servers URL to a verified host","Install correct CA certificates for TLS endpoints"],"tags":["network","http","openapi"],"backgroundTag":"http-request-failed","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}