remotion-dev/remotion · error · TypeError
parameter 'diskSizeInMb' must be finite, but is ${diskSizeIn
Error message
parameter 'diskSizeInMb' must be finite, but is ${diskSizeInMb} What it means
Third guard in validateDiskSizeInMb: the number must be finite. Infinity/-Infinity pass the typeof and NaN checks but are not valid disk sizes, so Number.isFinite() catches them. The message interpolates the offending value.
Source
Thrown at packages/lambda-client/src/validate-disk-size-in-mb.ts:18
import {
MAX_EPHEMERAL_STORAGE_IN_MB,
MIN_EPHEMERAL_STORAGE_IN_MB,
} from './constants';
export const validateDiskSizeInMb = (diskSizeInMb: unknown) => {
if (typeof diskSizeInMb !== 'number') {
throw new TypeError(
`parameter 'diskSizeInMb' must be a number, got a ${typeof diskSizeInMb}`,
);
}
if (Number.isNaN(diskSizeInMb)) {
throw new TypeError(`parameter 'diskSizeInMb' must not be NaN, but is`);
}
if (!Number.isFinite(diskSizeInMb)) {
throw new TypeError(
`parameter 'diskSizeInMb' must be finite, but is ${diskSizeInMb}`,
);
}
if (
diskSizeInMb < MIN_EPHEMERAL_STORAGE_IN_MB ||
diskSizeInMb > MAX_EPHEMERAL_STORAGE_IN_MB
) {
throw new TypeError(
`parameter 'diskSizeInMb' must be between ${MIN_EPHEMERAL_STORAGE_IN_MB} and ${MAX_EPHEMERAL_STORAGE_IN_MB}, but got ${diskSizeInMb}`,
);
}
if (diskSizeInMb % 1 !== 0) {
throw new TypeError(
`parameter 'diskSizeInMb' must be an integer but got ${diskSizeInMb}`,
);
}View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Clamp the computed value with Math.min/Math.max against the valid range before calling.
- Reject or default non-finite inputs in your config layer.
- Check Number.isFinite() upstream before validation.
Example fix
// before const disk = totalSpace / freeRatio; // Infinity when freeRatio === 0 validateDiskSizeInMb(disk); // after const disk = Number.isFinite(totalSpace / freeRatio) ? totalSpace / freeRatio : 2048; validateDiskSizeInMb(disk);
Defensive patterns
Strategy: validation
Validate before calling
if (!Number.isFinite(diskSizeInMb)) {
throw new TypeError(`diskSizeInMb must be finite, got ${diskSizeInMb}`);
}
validateDiskSizeInMb(diskSizeInMb); Type guard
const isFiniteNumber = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v);
Prevention
- Clamp computed values with Math.min/Math.max before validation.
- Guard division-by-zero in disk-size calculations.
- Check Number.isFinite() at the config boundary.
When it happens
Trigger: Calling validateDiskSizeInMb with Infinity or -Infinity, e.g., from division by zero, Number('Infinity'), or unbounded arithmetic in a config builder.
Common situations: Computing disk size from a ratio that divides by zero; reading the literal 'Infinity' from config and coercing; bounds-math bugs producing Infinity.
Related errors
- parameter 'diskSizeInMb' must be a number, got a ${typeof di
- parameter 'diskSizeInMb' must not be NaN, but is
- Disk size must be a positive integer. Received: ${diskSizeIn
- parameter 'diskSizeInMb' must be between ${MIN_EPHEMERAL_STO
- parameter 'diskSizeInMb' must be an integer but got ${diskSi
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/b324be938733fdca.
Report an issue: GitHub.