{"record":{"id":"d8db13bc937dc6d4","repo":"diegosouzapw/OmniRoute","slug":"kiro-prelude-crc-mismatch-expected-preludecrc","errorCode":null,"errorMessage":"[Kiro] Prelude CRC mismatch: expected ${preludeCRC}, got ${computedPreludeCRC} — skipping corrupted frame","messagePattern":"\\[Kiro\\] Prelude CRC mismatch: expected (.+?), got (.+?) — skipping corrupted frame","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"open-sse/executors/kiro/eventstream.ts","lineNumber":111,"sourceCode":"  }\n  return (crc ^ 0xffffffff) >>> 0;\n}\n\n/**\n * Parse AWS EventStream frame\n */\nexport function parseEventFrame(data: Uint8Array): EventFrame | null {\n  try {\n    const view = new DataView(data.buffer, data.byteOffset);\n    const totalLength = view.getUint32(0, false);\n    const headersLength = view.getUint32(4, false);\n\n    // ── CRC32 validation ──\n    // Prelude CRC covers bytes [0..7] (totalLength + headersLength)\n    const preludeCRC = view.getUint32(8, false);\n    const computedPreludeCRC = crc32(data.slice(0, 8));\n    if (preludeCRC !== computedPreludeCRC) {\n      console.warn(\n        `[Kiro] Prelude CRC mismatch: expected ${preludeCRC}, got ${computedPreludeCRC} — skipping corrupted frame`\n      );\n      return null;\n    }\n\n    // Message CRC covers bytes [0..totalLength-5] (everything except the CRC itself).\n    // Skipped by default (O(frame bytes) per frame) — the prelude CRC above already\n    // validates framing and the stream is TLS-protected. Enable KIRO_VERIFY_FULL_CRC=true\n    // to restore full validation for debugging corrupted-stream issues.\n    if (KIRO_VERIFY_FULL_CRC) {\n      const messageCRC = view.getUint32(data.length - 4, false);\n      const computedMessageCRC = crc32(data.slice(0, data.length - 4));\n      if (messageCRC !== computedMessageCRC) {\n        console.warn(\n          `[Kiro] Message CRC mismatch: expected ${messageCRC}, got ${computedMessageCRC} — skipping corrupted frame`\n        );\n        return null;\n      }","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/kiro/eventstream.ts#L93-L129","documentation":"Error \"[Kiro] Prelude CRC mismatch: expected ${preludeCRC}, got ${computedPreludeCRC} — skipping corrupted frame\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at open-sse/executors/kiro/eventstream.ts:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}