{"record":{"id":"15697e837198673b","repo":"Hmbown/CodeWhale","slug":"get-timeout","errorCode":null,"errorMessage":"GET timeout","messagePattern":"GET timeout","errorType":"http","errorClass":"anyhow","httpStatus":null,"severity":"warning","filePath":"crates/tui/src/mcp/http.rs","lineNumber":221,"sourceCode":"        let headers = tokio::select! {\n            biased;\n            _ = cancel.cancelled() => {\n                anyhow::bail!(\"MCP session preflight cancelled after plugin authority changed\")\n            }\n            headers = transport.auth.resolved_headers() => headers?,\n        };\n        let request = apply_safe_custom_headers(\n            with_default_mcp_http_headers(transport.client.get(&transport.url), false),\n            &headers,\n        );\n        let response = tokio::select! {\n            biased;\n            _ = cancel.cancelled() => {\n                anyhow::bail!(\"MCP session preflight cancelled after plugin authority changed\")\n            }\n            response = tokio::time::timeout(Duration::from_secs(5), transport.client.send(request)) => {\n                response\n                    .map_err(|_| anyhow::anyhow!(\"GET timeout\"))?\n                    .map_err(|e| anyhow::anyhow!(\"GET error: {e}\"))?\n            }\n        };\n\n        // Capture session ID from the GET response so subsequent POSTs\n        // (including `initialize`) can include it. This is the same\n        // header-reading logic that would be hit inside\n        // `StreamableHttpTransport::send` for POST responses, but since\n        // the GET is sent before any POST we do it here directly.\n        if let Some(sid) = response\n            .headers()\n            .get(\"Mcp-Session-Id\")\n            .and_then(|v| v.to_str().ok())\n            && transport.session_id.as_deref() != Some(sid)\n        {\n            let session_ref = crate::utils::redacted_identifier_for_log(sid);\n            tracing::debug!(target: \"mcp\", session = %session_ref, \"captured MCP session ID via GET preflight\");\n            transport.session_id = Some(sid.to_string());","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/mcp/http.rs#L203-L239","documentation":"During the Streamable HTTP session preflight, the transport opens a GET (SSE) request to establish a session, wrapped in a 5-second `tokio::time::timeout`. The elapsed arm of the select maps to \"GET timeout\" — the server did not respond to the session-establishing GET within 5 seconds.","triggerScenarios":"Connecting to an MCP Streamable HTTP server whose GET preflight request takes longer than 5 seconds — slow or overloaded server, network latency, or a server that never opens the SSE stream for this endpoint.","commonSituations":"Remote MCP servers behind slow proxies or cold-starting serverless functions; corporate VPN latency; the server does not support the GET preflight and never responds.","solutions":["Retry the connection; transient latency often clears on a second attempt.","Check server health and network latency to the MCP endpoint (curl the URL with a 5s budget).","Reduce server cold-start time or move the MCP endpoint closer to the client; if the server never answers GET preflight, verify it supports Streamable HTTP sessions."],"exampleFix":"// serverless function cold-start\n// before: direct connect to cold lambda URL\n// after: keep-alive ping or provisioned-concurrency on the MCP endpoint","handlingStrategy":"retry","validationCode":"// preflight connectivity check before opening the MCP session\nlet ok = tokio::time::timeout(\n    std::time::Duration::from_secs(5),\n    reqwest::get(url),\n).await;\nif ok.is_err() { eprintln!(\"endpoint not responding within 5s\"); }","typeGuard":null,"tryCatchPattern":"match connect_with_policy(...) {\n    Err(e) if e.to_string().contains(\"GET timeout\") => {\n        // retry with backoff; alert if the endpoint is persistently slow\n    }\n    other => other?,\n}","preventionTips":["Monitor MCP endpoint latency and cold-start times","Avoid serverless cold starts for MCP servers (provisioned concurrency)","Warn users when the endpoint is on a high-latency network path"],"tags":["network","timeout","http"],"backgroundTag":"request-timeout","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}