remotion-dev/remotion · error · TypeError
maxRetries must be finite, but is ${maxRetries}
Error message
maxRetries must be finite, but is ${maxRetries} What it means
Thrown by validateMaxRetries() (a TypeError) when the value is a number but fails Number.isFinite() (Infinity or -Infinity). Retry counts must be a concrete non-negative integer.
Source
Thrown at packages/lambda/src/shared/validate-retries.ts:11
export function validateMaxRetries(
maxRetries: unknown,
): asserts maxRetries is number {
if (typeof maxRetries !== 'number') {
throw new TypeError(
'maxRetries must be a number, but is ' + JSON.stringify(maxRetries),
);
}
if (!Number.isFinite(maxRetries)) {
throw new TypeError('maxRetries must be finite, but is ' + maxRetries);
}
if (Number.isNaN(maxRetries)) {
throw new TypeError('maxRetries is NaN');
}
if (maxRetries < 0) {
throw new TypeError(`maxRetries cannot be negative but is ${maxRetries}`);
}
if (maxRetries % 1 !== 0) {
throw new TypeError(
`maxRetries should be an integer, but is ${maxRetries}.`,
);
}
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Use Number.isFinite() to reject non-finite values before the API call.
- Pick a concrete retry count (e.g. 1-3) instead of an unbounded sentinel.
- Audit formulas producing maxRetries for divide-by-zero paths.
Example fix
// before const maxRetries = someCount / divisor // divisor 0 -> Infinity // after const maxRetries = Number.isFinite(someCount / divisor) ? someCount / divisor : 1
Defensive patterns
Strategy: validation
Validate before calling
if (typeof maxRetries === 'number' && !Number.isFinite(maxRetries)) {
throw new TypeError('maxRetries must be finite')
} Type guard
const isFiniteRetries = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v) && Number.isInteger(v) && v >= 0
Prevention
- Reject non-finite values with Number.isFinite() before the API call.
- Use a concrete retry count instead of 'Infinity'.
- Audit retry-count formulas for divide-by-zero paths.
When it happens
Trigger: Passing Infinity (e.g. Number('Infinity'), divide-by-zero), or a value coerced from 'Infinity' string.
Common situations: Defaulting to Infinity intending 'retry forever'; arithmetic that can divide by zero; parsing untrusted input that contained 'Infinity'.
Related errors
- maxRetries must be a number, but is ${JSON.stringify(maxRetr
- A custom role ARN must either be "undefined" or a string, bu
- CloudWatch retention period should be a number, got: ${JSON.
- CloudWatch retention period must be an integer, but is NaN
- CloudWatch retention period must be finite, but is ${period}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/6dc82683de3b5d10.
Report an issue: GitHub.