{"record":{"id":"4ffe5db2bba70539","repo":"zed-industries/zed","slug":"unexpected-content-type","errorCode":null,"errorMessage":"Unexpected content type: {:?}","messagePattern":"Unexpected content type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/context_server/src/transport/http.rs","lineNumber":248,"sourceCode":"\n                        // Only send non-empty responses\n                        if !body.is_empty() {\n                            self.response_tx\n                                .send(body)\n                                .await\n                                .map_err(|_| anyhow!(\"Failed to send JSON response\"))?;\n                        }\n                    }\n                    Some(ct) if ct.starts_with(EVENT_STREAM_MIME_TYPE) => {\n                        // SSE stream - set up streaming\n                        self.setup_sse_stream(response).await?;\n                    }\n                    _ => {\n                        // For notifications, 202 Accepted with no content type is ok\n                        if is_notification && status.as_u16() == 202 {\n                            log::debug!(\"Notification accepted\");\n                        } else {\n                            return Err(anyhow!(\"Unexpected content type: {:?}\", content_type));\n                        }\n                    }\n                }\n            }\n            status if status.as_u16() == 202 => {\n                // Accepted - notification acknowledged, no response needed\n                log::debug!(\"Notification accepted\");\n            }\n            _ => {\n                let mut error_body = String::new();\n                futures::AsyncReadExt::read_to_string(response.body_mut(), &mut error_body).await?;\n\n                self.error_tx\n                    .send(format!(\"HTTP {}: {}\", response.status(), error_body))\n                    .await\n                    .map_err(|_| anyhow!(\"Failed to send error\"))?;\n            }\n        }","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/context_server/src/transport/http.rs#L230-L266","documentation":"send_message inspects the HTTP response Content-Type when the context server answers a POST; anything other than application/json (handled above) or text/event-stream (SSE) hits this guard, meaning the streamable-HTTP server replied with an unexpected media type.","triggerScenarios":"Thrown at crates/context_server/src/transport/http.rs:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the context server responds with application/json or text/event-stream","Check for a proxy or misconfiguration altering response content types"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}