diegosouzapw/OmniRoute · error · Error
Video duration must be positive
Error message
Video duration must be positive
What it means
Guard at the top of calculateFrameTimestamps(): the duration passed in (typically from ffprobe metadata) was NaN, Infinity, zero or negative, so evenly spaced frame timestamps cannot be computed. Indicates upstream duration parsing failed or produced garbage.
Solutions
- Validate the ffprobe-derived duration before calling calculateFrameTimestamps and reject the upload with a 4xx when it is non-positive
- Re-probe the video metadata once (cache may be stale) before failing
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/guardrails/videoBridgeRuntime.ts:219 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/e02a9cfe2ad04871.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/guardrails/videoBridgeRuntime.ts:219
ffmpegVersion: null,
ffprobeVersion: null,
reason: "FFmpeg and ffprobe are not available on PATH",
};
}
runtimeProbeCache = {
expiresAt: now + (options.cacheTtlMs ?? 30_000),
value,
};
return structuredClone(value);
}
export function calculateFrameTimestamps(
durationSeconds: number,
requestedFrameCount: number
): number[] {
if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
throw new Error("Video duration must be positive");
}
if (
!Number.isInteger(requestedFrameCount) ||
requestedFrameCount < 1 ||
requestedFrameCount > 16
) {
throw new Error("Video frame count must be between 1 and 16");
}
const frameCount = Math.min(requestedFrameCount, Math.max(1, Math.floor(durationSeconds)));
return Array.from(
{ length: frameCount },
(_unused, index) => ((index + 0.5) * durationSeconds) / frameCount
);
}
function normalizeSceneCandidates(
durationSeconds: number,
candidates: readonly number[]View on GitHub (pinned to a179ffed5b)