{"record":{"id":"2bdffb4cad8ca80d","repo":"PrefectHQ/fastmcp","slug":"str-e","errorCode":null,"errorMessage":"str(e)","messagePattern":"str\\(e\\)","errorType":"exception","errorClass":"CIMDFetchError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/server/auth/cimd.py","lineNumber":365,"sourceCode":"            if cached.last_modified:\n                request_headers[\"If-Modified-Since\"] = cached.last_modified\n            if request_headers:\n                allowed_status_codes = {200, 304}\n\n        try:\n            response = await ssrf_safe_fetch_response(\n                client_id_url,\n                require_path=True,\n                max_size=self.MAX_RESPONSE_SIZE,\n                timeout=self.timeout,\n                overall_timeout=30.0,\n                request_headers=request_headers,\n                allowed_status_codes=allowed_status_codes,\n            )\n        except SSRFError as e:\n            raise CIMDValidationError(str(e)) from e\n        except SSRFFetchError as e:\n            raise CIMDFetchError(str(e)) from e\n\n        if response.status_code == 304:\n            if cached is None:\n                raise CIMDFetchError(\n                    \"CIMD server returned 304 Not Modified without cached document\"\n                )\n\n            now = time.time()\n            if self._has_freshness_headers(response.headers):\n                policy = self._parse_cache_policy(response.headers, now)\n            else:\n                # RFC allows 304 to omit unchanged headers. Preserve existing\n                # cache policy rather than resetting to fallback defaults.\n                policy = _CIMDCachePolicy(\n                    etag=None,\n                    last_modified=None,\n                    expires_at=now + cached.freshness_lifetime,\n                    freshness_lifetime=cached.freshness_lifetime,","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/server/auth/cimd.py#L347-L383","documentation":"When the SSRF-safe fetch layer fails at the transport level (connection errors, HTTP error statuses outside the allowed codes, timeouts), it raises SSRFFetchError. CIMDFetcher.fetch() wraps that message in CIMDFetchError, the fetch-specific exception type, so callers can distinguish 'could not retrieve document' from 'document invalid'.","triggerScenarios":"CIMDFetcher.fetch/get_client called with a client_id URL whose host is unreachable, returns 4xx/5xx (unless in allowed_status_codes), times out, or drops the connection.","commonSituations":"The client's metadata hosting site is down or misconfigured (404, DNS gone); TLS certificate errors; corporate firewalls blocking the server's outbound request; client removed their CIMD document after issuing a client_id.","solutions":["Verify the client_id URL is live and serves the CIMD document (curl it from the server host)","Check for DNS/TLS/proxy issues on the FastMCP server's outbound network","Catch CIMDFetchError and reject the request with invalid_client; the remote document owner must fix hosting","Retry with backoff only for transient statuses if you control the fetch policy"],"exampleFix":"try:\n    doc = await fetcher.get_client(client_id)\nexcept CIMDFetchError as e:\n    logger.warning(\"CIMD fetch failed for %s: %s\", client_id, e)\n    raise InvalidClientError() from e","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    doc = await fetcher.get_client(client_id)\nexcept CIMDFetchError as e:\n    logger.warning(\"CIMD fetch failed: %s\", e)\n    raise InvalidClientError() from e","preventionTips":["Monitor uptime of metadata hosting endpoints","Set reasonable fetch timeouts and allowed_status_codes for your environment","Verify the client_id URL is reachable from the server's network (egress firewalls)"],"tags":["oauth","cimd","network","http"],"backgroundTag":"http-fetch-failed","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}