diegosouzapw/OmniRoute · error · Error
Video focus window bounds must be finite
Error message
Video focus window bounds must be finite
What it means
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.
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/guardrails/videoBridgeRuntime.ts:102 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/42696674af81b429.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/guardrails/videoBridgeRuntime.ts:102
export interface VideoStructuralAnalysis {
freezeIntervals: VideoStructuralInterval[];
samples: VideoStructuralSample[];
sceneCandidates: number[];
}
export function resolveVideoFocusWindow(
durationSeconds: number,
bounds: VideoFocusBounds
): VideoFocusWindow | null {
if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
throw new Error("Video focus window requires a positive duration");
}
if (bounds.startSeconds === undefined && bounds.endSeconds === undefined) return null;
if (
(bounds.startSeconds !== undefined && !Number.isFinite(bounds.startSeconds)) ||
(bounds.endSeconds !== undefined && !Number.isFinite(bounds.endSeconds))
) {
throw new Error("Video focus window bounds must be finite");
}
const startSeconds = Math.max(0, Math.min(durationSeconds, bounds.startSeconds ?? 0));
const endSeconds = Math.max(0, Math.min(durationSeconds, bounds.endSeconds ?? durationSeconds));
if (endSeconds <= startSeconds) {
throw new Error("Video focus window must have a positive duration");
}
return { endSeconds, startSeconds };
}
export const VIDEO_FRAME_MAX_BYTES = 4 * 1024 * 1024;
export const VIDEO_FRAMES_TOTAL_MAX_BYTES = 23 * 1024 * 1024;
export const VIDEO_MAX_DIMENSION = 8_192;
export const VIDEO_MAX_PIXELS = 33_554_432;
const VIDEO_STRUCTURAL_ANALYSIS_FPS = 1;
const VIDEO_STRUCTURAL_ANALYSIS_MAX_SAMPLES = 600;
const VIDEO_STRUCTURAL_ANALYSIS_MAX_WIDTH = 320;
const VIDEO_STRUCTURAL_SCENE_THRESHOLD = 10;
View on GitHub (pinned to a179ffed5b)