diegosouzapw/OmniRoute · error · ClaudeWebProtocolError

SSE event exceeded the size limit

Error message

SSE event exceeded the size limit

What it means

Protocol guard in consumeLine: the accumulated data: lines of a single SSE event exceeded the pending-char budget (dataChars over the cap). One Claude Web event (joined data lines) is larger than allowed, indicating an oversized or malformed event rather than many small deltas.

Solutions

  1. Fail the stream with a protocol error and let the caller retry the whole turn
  2. Verify the response is genuinely SSE from claude.ai and not an error page
  3. Revisit the event-size budget only if upstream legitimately emits larger events
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at open-sse/executors/claude-web/stream.ts:103 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/5671a6953efd2acb. Report an issue: GitHub.

Appendix: source

Thrown at open-sse/executors/claude-web/stream.ts:103

    }
    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) {
        throw new ClaudeWebProtocolError("SSE event exceeded the size limit");
      }
      dataLines.push(value);
    }
    return null;
  };

  try {
    while (true) {
      const { value, done } = await reader.read();
      if (done) {
        reachedEof = true;
        break;
      }
      buffer += decoder.decode(value, { stream: true });

      let newlineIndex = buffer.indexOf("\n");
      while (newlineIndex >= 0) {
        const line = buffer.slice(0, newlineIndex);

View on GitHub (pinned to a179ffed5b)