remotion-dev/remotion · error · TypeError
Parameter 'durationInMilliseconds' must be over 0 but it is
Error message
Parameter 'durationInMilliseconds' must be over 0 but it is ${durationInMilliseconds}. What it means
Final guard in the estimatePrice validation chain: durationInMilliseconds < 0 throws a TypeError. A negative duration is nonsensical for a price estimate.
Source
Thrown at packages/lambda-client/src/estimate-price.ts:65
throw new TypeError(
`Parameter 'durationInMilliseconds' must be a number but got ${typeof durationInMilliseconds}`,
);
}
if (Number.isNaN(durationInMilliseconds)) {
throw new TypeError(
`Parameter 'durationInMilliseconds' must not be NaN but it is.`,
);
}
if (!Number.isFinite(durationInMilliseconds)) {
throw new TypeError(
`Parameter 'durationInMilliseconds' must be finite but it is ${durationInMilliseconds}`,
);
}
if (durationInMilliseconds < 0) {
throw new TypeError(
`Parameter 'durationInMilliseconds' must be over 0 but it is ${durationInMilliseconds}.`,
);
}
const durationPrice = pricing[region]['Lambda Duration-ARM'].price;
// In GB-second
const timeCostDollars =
Number(durationPrice) *
((memorySizeInMb * durationInMilliseconds) / 1000 / 1024);
const diskSizePrice = pricing[region]['Lambda Storage-Duration-ARM'].price;
const chargedDiskSize = Math.max(
0,
diskSizeInMb - MIN_EPHEMERAL_STORAGE_IN_MB,
);
// In GB-secondView on GitHub (pinned to 78fe4bb3fd)
Solutions
- Clamp durationInMilliseconds to >= 0 (Math.max(0, value)) before calling
- Fix the upstream subtraction that produced a negative duration
Example fix
// before const durationInMilliseconds = end - start; // reversed -> negative // after const durationInMilliseconds = Math.max(0, start - end);
Defensive patterns
Strategy: validation
Validate before calling
const durationInMilliseconds = Math.max(0, start - end);
Type guard
const isDuration = (v: unknown): v is number => typeof v === 'number' && !Number.isNaN(v) && Number.isFinite(v) && v >= 0;
Prevention
- Compute durations as (start - end) with the correct operand order
- Default missing durations to 0 rather than a sentinel like -1
When it happens
Trigger: durationInMilliseconds is a finite number but negative (e.g. a clock skew or a subtraction that went below zero).
Common situations: Negative duration from end-start math with reversed operands, bad default value of -1, sign error.
Related errors
- "stops" must be >= ${MIN_STOPS}, but got ${JSON.stringify(st
- "stops" must be <= ${MAX_STOPS}, but got ${JSON.stringify(st
- "${name}" must be >= 1
- "${name}" must be greater than 0, but got ${JSON.stringify(v
- "${name}" must be >= ${min}, but got ${JSON.stringify(value)
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/1768e908ee2468af.
Report an issue: GitHub.