diegosouzapw/OmniRoute · error

Video frame is not a JPEG data URI

Error message

Video frame is not a JPEG data URI

What it means

Error "Video frame is not a JPEG data URI" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/guardrails/videoBridgeHelpers.ts:373

/**
 * Compare JPEG frames using the versioned 16x16 grayscale visual policy.
 *
 * @param previous - Last frame retained by deduplication.
 * @param current - Candidate frame being evaluated.
 * @param signal - Optional request cancellation signal checked around asynchronous image work.
 * @returns The larger of mean luma delta and the ratio of materially changed cells.
 * @throws When cancelled or when either frame cannot be decoded as a JPEG data URI.
 */
export async function compareVideoFramesByGrayscale(
  previous: VideoCaptionFrame,
  current: VideoCaptionFrame,
  signal?: AbortSignal
): Promise<number> {
  throwIfVideoDedupAborted(signal);
  const decode = (dataUri: string): Buffer => {
    const match = /^data:image\/jpeg;base64,([A-Za-z0-9+/=]+)$/i.exec(dataUri);
    if (!match) throw new Error("Video frame is not a JPEG data URI");
    return Buffer.from(match[1], "base64");
  };
  const { default: sharp } = await import("sharp");
  throwIfVideoDedupAborted(signal);
  const [left, right] = await Promise.all(
    [previous, current].map((frame) =>
      sharp(decode(frame.dataUri)).resize(16, 16, { fit: "fill" }).greyscale().raw().toBuffer()
    )
  );
  throwIfVideoDedupAborted(signal);
  if (left.length !== right.length || left.length === 0) {
    throw new Error("Video frame comparison returned invalid dimensions");
  }
  let difference = 0;
  let changedCells = 0;
  for (let index = 0; index < left.length; index++) {
    const cellDifference = Math.abs(left[index] - right[index]) / 255;
    difference += cellDifference;

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/guardrails/videoBridgeHelpers.ts:373 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/410024d5cdebc783. Report an issue: GitHub.