diegosouzapw/OmniRoute · error · Error
Kimi Connect frame contained invalid JSON: ${error instanceo
Error message
Kimi Connect frame contained invalid JSON: ${error instanceof Error ? error.message : "parse failed"} What it means
Error "Kimi Connect frame contained invalid JSON: ${error instanceof Error ? error.message : "parse failed"}" thrown in diegosouzapw/OmniRoute.
Source
Thrown at open-sse/executors/kimi-web.ts:133
buf[byteOffset + 4];
// Sign-extend the high bit back to negative when len was read as signed.
const msgLen = len < 0 ? len + 0x100000000 : len;
if (msgLen > MAX_FRAME_LEN) return { consumed: -1, frame: null };
if (byteOffset + 5 + msgLen > buf.length) return { consumed: 0, frame: null };
if ((flags & ~0x03) !== 0) {
throw new Error(`Kimi Connect frame used unsupported flags: ${flags}`);
}
if ((flags & 0x01) !== 0) {
throw new Error("Kimi Connect compressed frames are not supported");
}
const payload = buf.subarray(byteOffset + 5, byteOffset + 5 + msgLen);
let message: Record<string, unknown> | null = null;
if (msgLen > 0) {
try {
message = JSON.parse(new TextDecoder().decode(payload));
} catch (error) {
throw new Error(
`Kimi Connect frame contained invalid JSON: ${error instanceof Error ? error.message : "parse failed"}`
);
}
}
return { consumed: 5 + msgLen, frame: { flags, message } };
}
export function getConnectEndStreamError(frame: ConnectFrame): string | null {
if ((frame.flags & 0x02) === 0) return null;
const error = frame.message?.error;
if (!error || typeof error !== "object" || Array.isArray(error)) return null;
const record = error as Record<string, unknown>;
const code = typeof record.code === "string" ? record.code : "unknown";
const message = typeof record.message === "string" ? record.message : "upstream error";
return `${code}: ${message}`;
}
type DeltaKind = "text" | "think" | null;View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at open-sse/executors/kimi-web.ts:133 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/277f52891e6084ed.
Report an issue: GitHub.