{"record":{"id":"a8d4446bb7a9fd8a","repo":"diegosouzapw/OmniRoute","slug":"inline-video-exceeds-the-maximum-size","errorCode":null,"errorMessage":"Inline video exceeds the maximum size","messagePattern":"Inline video exceeds the maximum size","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/guardrails/videoBridgeHelpers.ts","lineNumber":480,"sourceCode":"  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 {\n  const match = /^data:video\\/[A-Za-z0-9.+-]+;base64,([A-Za-z0-9+/=\\s]+)$/i.exec(ref);\n  if (!match) return null;\n  const normalized = normalizeBase64(match[1]);\n  const estimatedBytes = estimateNormalizedBase64Bytes(normalized);\n  if (estimatedBytes > maxBytes) {\n    throw new Error(\"Inline video exceeds the maximum size\");\n  }\n  return decode(normalized);\n}\n\n/**\n * Load protected video bytes from an inline data URI or SSRF-guarded HTTPS source.\n *\n * @param part - Extracted request video part.\n * @param maxBytes - Maximum accepted decoded/downloaded size.\n * @param timeoutMs - Download deadline passed to the protected fetch boundary.\n * @param signal - Caller abort/deadline signal.\n * @param deps - Injectable external download boundary.\n * @returns Validated video bytes suitable for hashing and extraction.\n * @throws When the source, size, deadline, or abort policy rejects the input.\n */\nexport async function loadVideoPartBytes(\n  part: VideoPart,\n  maxBytes: number,","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/guardrails/videoBridgeHelpers.ts#L462-L498","documentation":"Size-limit guard: an inline video data URI decodes to more than the allowed inline maximum (VIDEO_BRIDGE_INLINE_MAX_BYTES, applied via decodeVideoDataUri). The message distinguishes inline parts from remote fetches; inline videos have a stricter cap because they are held entirely in memory/request body.","triggerScenarios":"Thrown at src/lib/guardrails/videoBridgeHelpers.ts:480 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Have clients upload large videos by HTTPS URL instead of inlining base64","Raise VIDEO_BRIDGE_INLINE_MAX_BYTES only with an explicit memory-impact review","Return a clear size-limit error to the client before extraction work begins"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}