diegosouzapw/OmniRoute · error

Invalid video transcript: expected a cues array

Error message

Invalid video transcript: expected a cues array

What it means

Validation guard in normalizeVideoTranscript: the transcript metadata attached to a video part is neither an array of cues nor an object with a cues array. Only undefined/null are tolerated (return []). Any other shape — string, number, object without cues — is rejected so downstream cue parsing never sees malformed data.

Solutions

  1. Fix the client/embedded metadata producer to send {cues:[...]} or a plain array
  2. Strip or ignore malformed transcript fields before attaching them to video parts
  3. Validate transcript shape at ingestion instead of at normalization time
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/guardrails/videoBridgeHelpers.ts:121 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/50c1523403795bef. Report an issue: GitHub.

Appendix: source

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

const VIDEO_TRANSCRIPT_SOURCES: ReadonlySet<VideoTranscriptSource> = new Set([
  "audio-bridge",
  "client",
  "embedded",
]);

/** Validate optional transcript metadata without ever invoking a transcription provider. */
export function normalizeVideoTranscript(
  value: unknown,
  durationSeconds: number
): VideoTranscriptCue[] {
  if (value === undefined || value === null) return [];
  const rawCues = Array.isArray(value)
    ? value
    : value && typeof value === "object" && Array.isArray((value as Record<string, unknown>).cues)
      ? (value as Record<string, unknown>).cues
      : null;
  if (!rawCues) throw new Error("Invalid video transcript: expected a cues array");
  if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
    throw new Error("Invalid video transcript duration");
  }
  const seen = new Set<string>();
  const normalized: VideoTranscriptCue[] = [];
  for (const cue of rawCues) {
    if (!cue || typeof cue !== "object") throw new Error("Invalid video transcript cue");
    const record = cue as Record<string, unknown>;
    const text = typeof record.text === "string" ? record.text.trim() : "";
    const source = record.source;
    const startSeconds =
      typeof record.startSeconds === "number"
        ? record.startSeconds
        : typeof record.start === "number"
          ? record.start
          : Number.NaN;
    const endSeconds =
      typeof record.endSeconds === "number"

View on GitHub (pinned to a179ffed5b)