{"record":{"id":"42696674af81b429","repo":"diegosouzapw/OmniRoute","slug":"video-focus-window-bounds-must-be-finite","errorCode":null,"errorMessage":"Video focus window bounds must be finite","messagePattern":"Video focus window bounds must be finite","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/guardrails/videoBridgeRuntime.ts","lineNumber":102,"sourceCode":"export interface VideoStructuralAnalysis {\n  freezeIntervals: VideoStructuralInterval[];\n  samples: VideoStructuralSample[];\n  sceneCandidates: number[];\n}\n\nexport function resolveVideoFocusWindow(\n  durationSeconds: number,\n  bounds: VideoFocusBounds\n): VideoFocusWindow | null {\n  if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {\n    throw new Error(\"Video focus window requires a positive duration\");\n  }\n  if (bounds.startSeconds === undefined && bounds.endSeconds === undefined) return null;\n  if (\n    (bounds.startSeconds !== undefined && !Number.isFinite(bounds.startSeconds)) ||\n    (bounds.endSeconds !== undefined && !Number.isFinite(bounds.endSeconds))\n  ) {\n    throw new Error(\"Video focus window bounds must be finite\");\n  }\n  const startSeconds = Math.max(0, Math.min(durationSeconds, bounds.startSeconds ?? 0));\n  const endSeconds = Math.max(0, Math.min(durationSeconds, bounds.endSeconds ?? durationSeconds));\n  if (endSeconds <= startSeconds) {\n    throw new Error(\"Video focus window must have a positive duration\");\n  }\n  return { endSeconds, startSeconds };\n}\n\nexport const VIDEO_FRAME_MAX_BYTES = 4 * 1024 * 1024;\nexport const VIDEO_FRAMES_TOTAL_MAX_BYTES = 23 * 1024 * 1024;\nexport const VIDEO_MAX_DIMENSION = 8_192;\nexport const VIDEO_MAX_PIXELS = 33_554_432;\nconst VIDEO_STRUCTURAL_ANALYSIS_FPS = 1;\nconst VIDEO_STRUCTURAL_ANALYSIS_MAX_SAMPLES = 600;\nconst VIDEO_STRUCTURAL_ANALYSIS_MAX_WIDTH = 320;\nconst VIDEO_STRUCTURAL_SCENE_THRESHOLD = 10;\n","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/guardrails/videoBridgeRuntime.ts#L84-L120","documentation":"Bounds guard in resolveVideoFocusWindow: startSeconds or endSeconds was provided but is not a finite number (NaN/Infinity, typically from bad JSON or unit mistakes). Only undefined bounds are treated as absent; present-but-invalid values are rejected so window clamping operates on real numbers.","triggerScenarios":"Thrown at src/lib/guardrails/videoBridgeRuntime.ts:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Coerce numeric strings to numbers before constructing VideoFocusBounds","Fix producers sending null/NaN bounds instead of omitting the field","Clamp bounds to [0, durationSeconds] only after finiteness validation"],"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"}