diegosouzapw/OmniRoute · error
[codex] SSE payload parse failed, using raw payload
Error message
[codex] SSE payload parse failed, using raw payload
What it means
Error "[codex] SSE payload parse failed, using raw payload" thrown in diegosouzapw/OmniRoute.
Source
Thrown at open-sse/executors/codex.ts:734
export function encodeResponseSseEvent(raw: string): { sse: string; terminal: boolean } {
let eventType = "message";
let payload = raw;
let terminal = false;
try {
const parsed = JSON.parse(raw);
if (parsed && typeof parsed.type === "string" && parsed.type.trim()) {
eventType = parsed.type.trim();
if (eventType === "error" || eventType === "response.failed") {
const failed = toCodexResponseFailedEvent(parsed as Record<string, unknown>);
payload = JSON.stringify(failed);
eventType = "response.failed";
}
terminal = eventType === "response.completed" || eventType === "response.failed";
}
} catch {
console.warn("[codex] SSE payload parse failed, using raw payload");
// Keep message as the generic SSE event for non-JSON upstream payloads.
}
// Env-gated: drop non-standard `codex.*` events (notably `codex.rate_limits`)
// before they reach the client. They are NOT part of the OpenAI Responses API
// and break strict consumers: the OpenAI SDK's responses.stream() chokes on
// the unknown event type / empty data and tears the stream down, surfacing as
// "Invalid state: Controller is already closed". The earlier empty-payload
// check below never caught codex.rate_limits — over WS the frame carries a
// non-empty JSON payload (`{"type":"codex.rate_limits", ...}`), so
// `!payload.trim()` is false. Match by event type instead. Default ON via
// OMNIROUTE_CODEX_DROP_NONSTANDARD_EVENTS (#11014); the HTTP transport is handled
// separately by filterNonstandardCodexSse, since super.execute forwards the
// upstream stream verbatim and never runs this function).
if (eventType.startsWith("codex.") && codexDropNonstandardEvents()) {
return { sse: "", terminal };
}
View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at open-sse/executors/codex.ts:734 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/3615bed9cf928ed4.
Report an issue: GitHub.