diegosouzapw/OmniRoute · error

Contact sheet requires JPEG data URIs

Error message

Contact sheet requires JPEG data URIs

What it means

Error "Contact sheet requires JPEG data URIs" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/guardrails/videoBridgeContactSheet.ts:40

const MAX_FRAMES = 16;
const MAX_SHEET_BYTES = 32 * 1024 * 1024;
const LABEL_FONT_SIZE = 32;
const LABEL_HEIGHT = 64;
const LABEL_PADDING = 16;
const TILE_SIZE = 512;

function fallback(frames: readonly ContactSheetFrame[]): VideoContactSheetResult {
  return {
    fallbackReason: "CONTACT_SHEET_UNAVAILABLE",
    frames: frames.map((frame) => ({ ...frame })),
    timestamps: frames.map((frame) => frame.timestampSeconds),
    used: false,
  };
}

function decodeFrame(dataUri: string): Buffer {
  const match = /^data:image\/jpeg;base64,([A-Za-z0-9+/=]{4,5592408})$/i.exec(dataUri);
  if (!match) throw new Error("Contact sheet requires JPEG data URIs");
  return Buffer.from(match[1], "base64");
}

function formatContactSheetTimestamp(timestampSeconds: number): string {
  const totalMilliseconds = Math.max(0, Math.round(timestampSeconds * 1000));
  const minutes = Math.floor(totalMilliseconds / 60_000);
  const seconds = Math.floor((totalMilliseconds % 60_000) / 1000);
  const milliseconds = totalMilliseconds % 1000;
  if (minutes > 999) return `t=${timestampSeconds.toExponential(3)}s`;
  return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}.${String(milliseconds).padStart(3, "0")}`;
}

function buildTimestampLabel(timestampSeconds: number): Buffer {
  const label = formatContactSheetTimestamp(timestampSeconds);
  const labelTop = TILE_SIZE - LABEL_HEIGHT;
  return Buffer.from(
    `<svg xmlns="http://www.w3.org/2000/svg" width="${TILE_SIZE}" height="${TILE_SIZE}" viewBox="0 0 ${TILE_SIZE} ${TILE_SIZE}">
      <rect x="0" y="${labelTop}" width="${TILE_SIZE}" height="${LABEL_HEIGHT}" fill="#000000" fill-opacity="0.82" />

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/guardrails/videoBridgeContactSheet.ts:40 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/28ccdda8247bf8a9. Report an issue: GitHub.