diegosouzapw/OmniRoute · error

Video frame comparison returned invalid dimensions

Error message

Video frame comparison returned invalid dimensions

What it means

Error "Video frame comparison returned invalid dimensions" thrown in diegosouzapw/OmniRoute.

Source

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

  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;
    if (cellDifference >= VIDEO_DEDUP_CELL_DELTA_THRESHOLD) changedCells += 1;
  }
  return Math.max(difference / left.length, changedCells / left.length);
}

export async function deduplicateVideoFrames(
  frames: readonly VideoCaptionFrame[],
  options: {
    compare?: VideoFrameComparator;
    maxFrames?: number;
    signal?: AbortSignal;
    threshold?: number;

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/guardrails/videoBridgeHelpers.ts:385 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/802f73c7d78da2bf. Report an issue: GitHub.