diegosouzapw/OmniRoute · error

Invalid video transcript cue

Error message

Invalid video transcript cue

What it means

Per-cue validation guard in normalizeVideoTranscript: an individual cue entry is not an object with a usable text field (or otherwise lacks the minimal cue shape). It fires while iterating rawCues when one entry deviates from the expected cue record; the transcript as a whole is rejected to keep provenance trustworthy.

Solutions

  1. Skip-and-log malformed cues instead of failing the whole transcript if partial acceptance is acceptable
  2. Enforce cue schema validation ({text,start,end,source}) at the metadata producer
  3. Sanitize client-supplied cue arrays before persisting them with the video part
Defensive patterns

Strategy: type-guard

When it happens

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

Appendix: source

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

/** 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"
        ? record.endSeconds
        : typeof record.end === "number"
          ? record.end
          : Number.NaN;
    const confidence = record.confidence === undefined ? 1 : record.confidence;
    if (
      !text ||

View on GitHub (pinned to a179ffed5b)