diegosouzapw/OmniRoute · error
Video data URI contains invalid base64
Error message
Video data URI contains invalid base64
What it means
Error "Video data URI contains invalid base64" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/lib/guardrails/videoBridgeHelpers.ts:456
? Math.max(1, Math.floor(options.maxFrames))
: kept.length;
if (kept.length <= maxFrames) return { dropped, frames: kept };
if (maxFrames === 1) return { dropped, frames: [kept[0]] };
const capped = Array.from({ length: maxFrames }, (_unused, index) => {
const sourceIndex = Math.round((index * (kept.length - 1)) / (maxFrames - 1));
return kept[sourceIndex];
});
return { dropped, frames: capped };
}
function normalizeBase64(base64: string): string {
const normalized = base64.replace(/\s/g, "");
if (
normalized.length === 0 ||
normalized.length % 4 !== 0 ||
!/^[A-Za-z0-9+/]*={0,2}$/.test(normalized)
) {
throw new Error("Video data URI contains invalid base64");
}
return normalized;
}
function estimateNormalizedBase64Bytes(normalized: string): number {
const padding = normalized.endsWith("==") ? 2 : normalized.endsWith("=") ? 1 : 0;
return (normalized.length / 4) * 3 - padding;
}
export function estimateDecodedBase64Bytes(base64: string): number {
return estimateNormalizedBase64Bytes(normalizeBase64(base64));
}
export function decodeVideoDataUri(
ref: string,
maxBytes = VIDEO_BRIDGE_INLINE_MAX_BYTES,
decode: (base64: string) => Buffer = (base64) => Buffer.from(base64, "base64")
): Buffer | null {View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/lib/guardrails/videoBridgeHelpers.ts:456 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/971f37e1279d4d1f.
Report an issue: GitHub.