diegosouzapw/OmniRoute · error · ClaudeWebProtocolError
Claude Web stream ended before message_stop
Error message
Claude Web stream ended before message_stop
What it means
Terminal-state guard in parseClaudeWebEvents: the SSE source reached EOF (or [DONE]) before a message_stop/finish semantic event was produced. The stream was cut off mid-message — usually a dropped connection, session expiry, or upstream error ending the stream early — so the assistant message is incomplete.
Solutions
- Retry the turn (fresh completion or retry_completion with preserved conversation state)
- Check cookie/session validity in the browser context if truncation recurs
- Emit a partial-content finish to the client when some text was already streamed, instead of dropping it
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at open-sse/executors/claude-web/stream.ts:418 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/f7922f575d72f697.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/executors/claude-web/stream.ts:418
for await (const data of decodeSseData(source, control)) {
if (data === "[DONE]") {
protocolFailure(state, "DONE arrived before message_stop");
}
const { event, eventType } = parseProtocolEvent(data, state);
if (KNOWN_METADATA_EVENTS.has(eventType)) {
yield { kind: "metadata", eventType, data: projectMetadataEvent(eventType, event) };
continue;
}
const semanticEvent = dispatchProtocolEvent(eventType, event, state);
if (!semanticEvent) continue;
yield semanticEvent;
if (semanticEvent.kind === "finish") return;
}
if (control.cancelled) return;
throw new ClaudeWebProtocolError("Claude Web stream ended before message_stop");
}
function openAiFinishReason(stopReason: string): string {
if (stopReason === "max_tokens") return "length";
if (stopReason === "tool_use") return "tool_calls";
return "stop";
}
function makeChunk(
id: string,
created: number,
options: ClaudeWebStreamOptions,
delta: Record<string, unknown>,
finishReason: string | null,
event?: { type: string; data: Record<string, unknown> }
): Record<string, unknown> {
return {
id,View on GitHub (pinned to a179ffed5b)