diegosouzapw/OmniRoute · error

[Kiro] Prelude CRC mismatch: expected

Error message

[Kiro] Prelude CRC mismatch: expected ${preludeCRC}, got ${computedPreludeCRC} — skipping corrupted frame

What it means

An AWS EventStream frame from Kiro failed the prelude CRC32 check (bytes 0..7: totalLength + headersLength do not match the stored CRC) — the frame is corrupted, likely from a transport glitch or desynchronization. The corrupted frame is skipped (parse returns null) and parsing continues with subsequent frames rather than aborting the stream.

Solutions

  1. Occasional mismatches are tolerated by design — monitor frequency
  2. Retry the request if output appears truncated
  3. Investigate network/proxy integrity if corruption is persistent
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at open-sse/executors/kiro/eventstream.ts:111 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/d8db13bc937dc6d4. Report an issue: GitHub.

Appendix: source

Thrown at open-sse/executors/kiro/eventstream.ts:111

  }
  return (crc ^ 0xffffffff) >>> 0;
}

/**
 * Parse AWS EventStream frame
 */
export function parseEventFrame(data: Uint8Array): EventFrame | null {
  try {
    const view = new DataView(data.buffer, data.byteOffset);
    const totalLength = view.getUint32(0, false);
    const headersLength = view.getUint32(4, false);

    // ── CRC32 validation ──
    // Prelude CRC covers bytes [0..7] (totalLength + headersLength)
    const preludeCRC = view.getUint32(8, false);
    const computedPreludeCRC = crc32(data.slice(0, 8));
    if (preludeCRC !== computedPreludeCRC) {
      console.warn(
        `[Kiro] Prelude CRC mismatch: expected ${preludeCRC}, got ${computedPreludeCRC} — skipping corrupted frame`
      );
      return null;
    }

    // Message CRC covers bytes [0..totalLength-5] (everything except the CRC itself).
    // Skipped by default (O(frame bytes) per frame) — the prelude CRC above already
    // validates framing and the stream is TLS-protected. Enable KIRO_VERIFY_FULL_CRC=true
    // to restore full validation for debugging corrupted-stream issues.
    if (KIRO_VERIFY_FULL_CRC) {
      const messageCRC = view.getUint32(data.length - 4, false);
      const computedMessageCRC = crc32(data.slice(0, data.length - 4));
      if (messageCRC !== computedMessageCRC) {
        console.warn(
          `[Kiro] Message CRC mismatch: expected ${messageCRC}, got ${computedMessageCRC} — skipping corrupted frame`
        );
        return null;
      }

View on GitHub (pinned to a179ffed5b)