diegosouzapw/OmniRoute · error · Error

Video runtime returned invalid duration metadata

Error message

Video runtime returned invalid duration metadata

What it means

After ffprobe runs, the parsed durationSeconds is not a finite positive number. The catch above deliberately hides raw ffprobe output, so this stable sentinel means metadata extraction failed or returned garbage.

Solutions

  1. Inspect the raw ffprobe JSON in server logs to see why the duration field is missing/non-numeric
  2. Treat the file as unsupported and reject it rather than retrying with the same probe
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/guardrails/videoBridgeRuntime.ts:796 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/c893649943b40c89. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/guardrails/videoBridgeRuntime.ts:796

          streamHeight > VIDEO_MAX_DIMENSION ||
          streamWidth * streamHeight > VIDEO_MAX_PIXELS
        );
      });
    const selectedStream = [...playableVideoStreams].sort((left, right) => {
      const defaultPreference =
        Number(dispositionFlag(right, "default")) - Number(dispositionFlag(left, "default"));
      return defaultPreference || Number(left.index) - Number(right.index);
    })[0];
    if (selectedStream) {
      streamIndex = Number(selectedStream.index);
      width = Number(selectedStream.width);
      height = Number(selectedStream.height);
    }
  } catch {
    // The stable error below deliberately excludes raw ffprobe output.
  }
  if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
    throw new Error("Video runtime returned invalid duration metadata");
  }
  if (durationSeconds > (options.maxDurationSeconds ?? 600)) {
    throw new Error("Video exceeds the maximum duration");
  }
  const formats = formatName
    .toLowerCase()
    .split(",")
    .map((entry) => entry.trim())
    .filter(Boolean);
  if (formats.length === 0 || formats.some((entry) => !SAFE_FORMATS.has(entry))) {
    throw new Error("Video container format is not allowed");
  }
  if (playableVideoStreamCount === 0) {
    throw new Error("Video container has no playable video stream");
  }
  if (!allVideoStreamsSafe) {
    throw new Error("Video stream metadata or dimensions exceed the safe processing limit");
  }

View on GitHub (pinned to a179ffed5b)