{"record":{"id":"971f37e1279d4d1f","repo":"diegosouzapw/OmniRoute","slug":"video-data-uri-contains-invalid-base64","errorCode":null,"errorMessage":"Video data URI contains invalid base64","messagePattern":"Video data URI contains invalid base64","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/guardrails/videoBridgeHelpers.ts","lineNumber":456,"sourceCode":"      ? Math.max(1, Math.floor(options.maxFrames))\n      : kept.length;\n  if (kept.length <= maxFrames) return { dropped, frames: kept };\n  if (maxFrames === 1) return { dropped, frames: [kept[0]] };\n  const capped = Array.from({ length: maxFrames }, (_unused, index) => {\n    const sourceIndex = Math.round((index * (kept.length - 1)) / (maxFrames - 1));\n    return kept[sourceIndex];\n  });\n  return { dropped, frames: capped };\n}\n\nfunction normalizeBase64(base64: string): string {\n  const normalized = base64.replace(/\\s/g, \"\");\n  if (\n    normalized.length === 0 ||\n    normalized.length % 4 !== 0 ||\n    !/^[A-Za-z0-9+/]*={0,2}$/.test(normalized)\n  ) {\n    throw new Error(\"Video data URI contains invalid base64\");\n  }\n  return normalized;\n}\n\nfunction estimateNormalizedBase64Bytes(normalized: string): number {\n  const padding = normalized.endsWith(\"==\") ? 2 : normalized.endsWith(\"=\") ? 1 : 0;\n  return (normalized.length / 4) * 3 - padding;\n}\n\nexport function estimateDecodedBase64Bytes(base64: string): number {\n  return estimateNormalizedBase64Bytes(normalizeBase64(base64));\n}\n\nexport function decodeVideoDataUri(\n  ref: string,\n  maxBytes = VIDEO_BRIDGE_INLINE_MAX_BYTES,\n  decode: (base64: string) => Buffer = (base64) => Buffer.from(base64, \"base64\")\n): Buffer | null {","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/guardrails/videoBridgeHelpers.ts#L438-L474","documentation":"Error \"Video data URI contains invalid base64\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/guardrails/videoBridgeHelpers.ts:456 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"}