diegosouzapw/OmniRoute · error · ClaudeWebProtocolError
Claude Web stream ended without a terminal event
Error message
Claude Web stream ended without a terminal event
What it means
Terminal-state guard in pullStreamingChunk: the semantic-event iterator finished (next.done) while state.terminal is still false — the Claude Web stream exhausted without ever yielding a finish event. Distinct from client cancellation (control.cancelled is checked first), this means upstream closed the stream before a terminal event.
Solutions
- Close the ReadableStream with an error so the client sees truncation instead of a clean end
- Retry the request via combo/fallback routing to another provider or a new Claude Web turn
- Verify session cookies if the stream consistently ends early
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at open-sse/executors/claude-web/stream.ts:720 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/cd304504f4c1fda1.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/executors/claude-web/stream.ts:720
}
async function pullStreamingChunk(
state: StreamingState,
options: ClaudeWebStreamOptions,
controller: ReadableStreamDefaultController<Uint8Array>
): Promise<void> {
if (state.closed || flushStreamChunk(state, controller)) return;
if (state.terminal) {
closeStreamIfDrained(state, controller);
return;
}
try {
while (!state.terminal) {
const next = await state.iterator.next();
if (state.control.cancelled) return;
if (next.done === true) {
throw new ClaudeWebProtocolError("Claude Web stream ended without a terminal event");
}
await queueSemanticEvent(state, next.value, options);
if (state.pendingChunks.length > 0) {
flushStreamChunk(state, controller);
return;
}
}
} catch {
if (state.control.cancelled) return;
queueStreamFailure(state, options);
flushStreamChunk(state, controller);
}
}
async function cancelStreaming(
state: StreamingState,
options: ClaudeWebStreamOptions,
reason: unknownView on GitHub (pinned to a179ffed5b)