diegosouzapw/OmniRoute · error · ClaudeWebProtocolError
SSE line exceeded the size limit
Error message
SSE line exceeded the size limit
What it means
Protocol guard in the SSE line decoder (consumeLine): a single raw line from the Claude Web stream exceeded MAX_CLAUDE_WEB_SSE_PENDING_CHARS. This bounds memory while buffering SSE lines and fires when the upstream emits an abnormally long line — usually a runaway payload or a non-SSE (HTML/binary) response being parsed as SSE.
Solutions
- Treat as a terminal protocol failure: end the stream with an error, do not retry the same response
- Check session/cookie validity — an HTML login page served instead of SSE often produces one giant line
- If legitimate payloads exceed the cap, raise MAX_CLAUDE_WEB_SSE_PENDING_CHARS after memory review
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at open-sse/executors/claude-web/stream.ts:84 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/884675843140feec.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/executors/claude-web/stream.ts:84
this.name = "ClaudeWebProtocolError";
}
}
async function* decodeSseData(
source: ReadableStream<Uint8Array>,
control: StreamControl
): AsyncGenerator<string, void, void> {
const reader = source.getReader();
control.reader = reader;
const decoder = new TextDecoder();
let buffer = "";
let dataLines: string[] = [];
let dataChars = 0;
let reachedEof = false;
const consumeLine = (rawLine: string): string | null => {
if (rawLine.length > MAX_CLAUDE_WEB_SSE_PENDING_CHARS) {
throw new ClaudeWebProtocolError("SSE line exceeded the size limit");
}
const line = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
if (line === "") {
if (dataLines.length === 0) return null;
const data = dataLines.join("\n");
dataLines = [];
dataChars = 0;
return data;
}
if (line.startsWith(":")) return null;
const separatorIndex = line.indexOf(":");
const field = separatorIndex < 0 ? line : line.slice(0, separatorIndex);
let value = separatorIndex < 0 ? "" : line.slice(separatorIndex + 1);
if (value.startsWith(" ")) value = value.slice(1);
if (field === "data") {
dataChars += value.length + (dataLines.length > 0 ? 1 : 0);
if (dataChars > MAX_CLAUDE_WEB_SSE_PENDING_CHARS) {View on GitHub (pinned to a179ffed5b)