Hmbown/CodeWhale · error
{err}
Error message
{err} What it means
A raw line could not be extracted from the SSE byte stream: super::take_sse_line returned Err and its detail is re-yielded verbatim at crates/tui/src/client/responses.rs:264. This guards the framing layer before any JSON parsing, so a failure means the stream itself is not well-formed SSE - an oversized line beyond the line buffer cap, invalid UTF-8, or CR/LF framing the parser rejects.
Source
Thrown at crates/tui/src/client/responses.rs:264
bytes_received,
stream_start.elapsed(),
last_chunk_at.elapsed(),
)));
return;
}
};
bytes_received += chunk.len();
last_chunk_at = std::time::Instant::now();
buffer.extend_from_slice(&chunk);
// Process complete SSE lines.
loop {
let line = match super::take_sse_line(&mut buffer) {
Ok(Some(line)) => line,
Ok(None) => break,
Err(err) => {
yield Err(anyhow::anyhow!("{err}"));
return;
}
};
if line.is_empty() || line.starts_with(':') {
continue;
}
if let Some(data) = super::extract_sse_data_value(&line) {
if data == "[DONE]" {
done = true;
break;
}
let event: Value = match serde_json::from_str(data) {
Ok(v) => v,
Err(e) => {
logging::warn(format!(View on GitHub (pinned to 8880682c63)
Solutions
- Capture the yielded {err} detail - it names the exact framing violation (line length vs UTF-8)
- Reproduce with curl -N --raw and the same headers to see the raw bytes the parser sees
- Disable proxy compression and buffering for text/event-stream routes
- If the provider returns a JSON error body with an SSE content type, handle it at the HTTP status layer before streaming
- Retry once - single corrupted responses do happen transiently
Defensive patterns
Strategy: try-catch
Try / catch
// Inspect the yielded framing error detail before deciding
match stream.next().await {
Some(Err(e)) if e.to_string().contains("line") || e.to_string().contains("utf") => {
log::warn!("SSE framing violation: {e}"); // capture raw bytes on next attempt
return Err(e); // do not retry blindly - framing bugs are deterministic
}
other => handle(other),
} Prevention
- Disable response compression on streaming routes
- Log the raw first 1KB of any failing stream to see injected error pages
- Assert content-type is text/event-stream before handing bytes to the SSE parser
When it happens
Trigger: A gateway injects an HTML error page or bare JSON error mid-stream while keeping content-type event-stream; a very long data line (large base64/image payload) exceeds the line limit; invalid UTF-8 bytes from a misbehaving proxy; response compression applied where the parser expects plain bytes.
Common situations: Reverse proxies that swap in branded error pages; providers answering errors with the SSE content type; enabling gzip on a streaming route; mirror endpoints that truncate responses.
Related errors
- {err}
- {err}
- Stream read error: {e}
- SSE stream idle timeout after {}s — no data received (bytes_
- Anthropic stream error ({error_type}): {message}
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/99ab9646309f02fe.
Report an issue: GitHub.