{"record":{"id":"69d3ac5970b82136","repo":"diegosouzapw/OmniRoute","slug":"video-stream-index-is-invalid","errorCode":null,"errorMessage":"Video stream index is invalid","messagePattern":"Video stream index is invalid","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/guardrails/videoBridgeRuntime.ts","lineNumber":606,"sourceCode":"    ...(focusWindow ? { focusWindow } : {}),\n    policyEffective: \"scene_aware\",\n    policyRequested: \"scene_aware\",\n    timestamps: selected,\n  };\n}\nexport async function detectSceneChangeTimestamps(\n  inputPath: string,\n  options: {\n    durationSeconds: number;\n    runner?: VideoCommandRunner;\n    signal?: AbortSignal;\n    streamIndex: number;\n    timeoutMs?: number;\n  }\n): Promise<number[]> {\n  assertLocalPath(inputPath);\n  if (!Number.isInteger(options.streamIndex) || options.streamIndex < 0) {\n    throw new Error(\"Video stream index is invalid\");\n  }\n  const result = await (options.runner ?? defaultRunner)(\n    \"ffmpeg\",\n    [\n      \"-nostdin\",\n      \"-hide_banner\",\n      \"-loglevel\",\n      \"info\",\n      \"-protocol_whitelist\",\n      \"file\",\n      \"-format_whitelist\",\n      SAFE_FORMAT_WHITELIST,\n      \"-threads\",\n      \"1\",\n      \"-i\",\n      inputPath,\n      \"-map\",\n      `0:${options.streamIndex}`,","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/guardrails/videoBridgeRuntime.ts#L588-L624","documentation":"detectSceneChangeTimestamps validates options.streamIndex: it must be a non-negative integer (a valid ffprobe stream selector). A fractional or negative index means the caller passed unparsed metadata.","triggerScenarios":"Thrown at src/lib/guardrails/videoBridgeRuntime.ts:606 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass Number(stream.index) from the ffprobe selection step, never the raw string","Default to stream index 0 when no selection was made"],"exampleFix":null,"handlingStrategy":"validation","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"}