{"record":{"id":"f676468b41d9f3e2","repo":"Hmbown/CodeWhale","slug":"failed-to-parse-anthropic-sse-event-e","errorCode":null,"errorMessage":"Failed to parse Anthropic SSE event: {e}","messagePattern":"Failed to parse Anthropic SSE event: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client/anthropic.rs","lineNumber":374,"sourceCode":"                    };\n\n                    match convert_anthropic_sse_data(data) {\n                        Some(Ok(StreamEvent::Error { error })) => {\n                            let (error_type, message) = anthropic_error_fields(&error);\n                            yield Err(anyhow::anyhow!(\n                                \"Anthropic stream error ({error_type}): {message}\"\n                            ));\n                            return;\n                        }\n                        Some(Ok(event)) => {\n                            let is_stop = matches!(event, StreamEvent::MessageStop);\n                            yield Ok(event);\n                            if is_stop {\n                                return;\n                            }\n                        }\n                        Some(Err(e)) => {\n                            logging::warn(format!(\"Failed to parse Anthropic SSE event: {e}\"));\n                        }\n                        None => {}\n                    }\n                }\n\n                if ended {\n                    break;\n                }\n            }\n        };\n\n        Ok(Box::pin(stream))\n    }\n\n    /// Handle a non-streaming Messages API request.\n    pub(super) async fn handle_anthropic_message(\n        &self,\n        prepared: &super::PreparedOutboundRequest,","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/client/anthropic.rs#L356-L392","documentation":"In the Anthropic SSE stream handler, convert_anthropic_sse_data failing to parse an event's data payload yields Err(\"Failed to parse Anthropic SSE event: {e}\") into the stream, terminating it. This fires when the upstream returns malformed or unexpected JSON on the SSE channel (proxy truncation, protocol drift, non-event body on a 200 stream) — the stream surfaces it as a normal error result for the turn rather than panicking.","triggerScenarios":"Thrown at crates/tui/src/client/anthropic.rs:374 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request; transient proxy truncation is the most common cause","Capture the raw SSE body (debug logging) if the error repeats to check for API protocol changes","Confirm no auth/error HTML page is being streamed in place of SSE events"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}