diegosouzapw/OmniRoute · error

Invalid video transcript timestamp or confidence range

Error message

Invalid video transcript timestamp or confidence range

What it means

Range guard in normalizeVideoTranscript: a cue's timing/confidence values are unusable — non-finite start/end/confidence, confidence outside [0,1], negative start, end beyond the video duration, or end <= start. This guarantees every accepted cue maps to a real, ordered, in-bounds interval of the video.

Solutions

  1. Clamp cue end times to the video duration at the producer instead of rejecting
  2. Fix unit mismatches (ms vs seconds) that produce out-of-range timestamps
  3. Validate confidence generation so it always lands in [0,1]
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    const confidence = record.confidence === undefined ? 1 : record.confidence;
    if (
      !text ||
      typeof source !== "string" ||
      !VIDEO_TRANSCRIPT_SOURCES.has(source as VideoTranscriptSource)
    ) {
      throw new Error("Invalid video transcript source or provenance");
    }
    if (
      !Number.isFinite(startSeconds) ||
      !Number.isFinite(endSeconds) ||
      !Number.isFinite(confidence) ||
      confidence < 0 ||
      confidence > 1 ||
      startSeconds < 0 ||
      endSeconds > durationSeconds ||
      endSeconds <= startSeconds
    ) {
      throw new Error("Invalid video transcript timestamp or confidence range");
    }
    const normalizedCue = {
      confidence,
      endSeconds,
      source: source as VideoTranscriptSource,
      startSeconds,
      text,
    } satisfies VideoTranscriptCue;
    const key = JSON.stringify(normalizedCue);
    if (!seen.has(key)) {
      seen.add(key);
      normalized.push(normalizedCue);
    }
  }
  return normalized.sort(
    (left, right) => left.startSeconds - right.startSeconds || left.endSeconds - right.endSeconds
  );
}

View on GitHub (pinned to a179ffed5b)