{"record":{"id":"7a571ac1d67c7082","repo":"diegosouzapw/OmniRoute","slug":"invalid-video-transcript-cue","errorCode":null,"errorMessage":"Invalid video transcript cue","messagePattern":"Invalid video transcript cue","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/guardrails/videoBridgeHelpers.ts","lineNumber":128,"sourceCode":"/** Validate optional transcript metadata without ever invoking a transcription provider. */\nexport function normalizeVideoTranscript(\n  value: unknown,\n  durationSeconds: number\n): VideoTranscriptCue[] {\n  if (value === undefined || value === null) return [];\n  const rawCues = Array.isArray(value)\n    ? value\n    : value && typeof value === \"object\" && Array.isArray((value as Record<string, unknown>).cues)\n      ? (value as Record<string, unknown>).cues\n      : null;\n  if (!rawCues) throw new Error(\"Invalid video transcript: expected a cues array\");\n  if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {\n    throw new Error(\"Invalid video transcript duration\");\n  }\n  const seen = new Set<string>();\n  const normalized: VideoTranscriptCue[] = [];\n  for (const cue of rawCues) {\n    if (!cue || typeof cue !== \"object\") throw new Error(\"Invalid video transcript cue\");\n    const record = cue as Record<string, unknown>;\n    const text = typeof record.text === \"string\" ? record.text.trim() : \"\";\n    const source = record.source;\n    const startSeconds =\n      typeof record.startSeconds === \"number\"\n        ? record.startSeconds\n        : typeof record.start === \"number\"\n          ? record.start\n          : Number.NaN;\n    const endSeconds =\n      typeof record.endSeconds === \"number\"\n        ? record.endSeconds\n        : typeof record.end === \"number\"\n          ? record.end\n          : Number.NaN;\n    const confidence = record.confidence === undefined ? 1 : record.confidence;\n    if (\n      !text ||","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/guardrails/videoBridgeHelpers.ts#L110-L146","documentation":"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.","triggerScenarios":"Thrown at src/lib/guardrails/videoBridgeHelpers.ts:128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Skip-and-log malformed cues instead of failing the whole transcript if partial acceptance is acceptable","Enforce cue schema validation ({text,start,end,source}) at the metadata producer","Sanitize client-supplied cue arrays before persisting them with the video part"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}