diegosouzapw/OmniRoute · error · Error

Kimi Connect compressed frames are not supported

Error message

Kimi Connect compressed frames are not supported

What it means

Wire-protocol guard in decodeConnectFrame: the frame's flags byte has the compression bit (0x01) set. The Kimi Connect decoder only handles uncompressed JSON payloads, so a compressed frame is rejected rather than misparsed.

Solutions

  1. Retry the turn — compression is often negotiated per-message and may not recur
  2. If Kimi always compresses now, add decompression support to the decoder (identify the codec from the stream)
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at open-sse/executors/kimi-web.ts:124 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/62853e1023f5c768. Report an issue: GitHub.

Appendix: source

Thrown at open-sse/executors/kimi-web.ts:124

  buf: Uint8Array,
  byteOffset: number
): { consumed: number; frame: ConnectFrame | null } {
  if (byteOffset + 5 > buf.length) return { consumed: 0, frame: null };
  const flags = buf[byteOffset];
  const len =
    (buf[byteOffset + 1] << 24) |
    (buf[byteOffset + 2] << 16) |
    (buf[byteOffset + 3] << 8) |
    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;

View on GitHub (pinned to a179ffed5b)