remotion-dev/remotion · error · Error

Disk size must be a positive integer. Received: ${diskSizeIn

Error message

Disk size must be a positive integer. Received: ${diskSizeInMb}

What it means

speculateFunctionName validates diskSizeInMb the same way as memory: Number()-coerced, must be a positive integer. Failures here usually mean a non-numeric or non-positive disk size was supplied to a function-name prediction.

Source

Thrown at packages/lambda-client/src/speculate-function-name.ts:44

 * @see [Documentation](https://remotion.dev/docs/lambda/speculatefunctionname)
 */
export const speculateFunctionName = ({
	memorySizeInMb,
	diskSizeInMb,
	timeoutInSeconds,
}: SpeculateFunctionNameInput) => {
	const memorySize = Number(memorySizeInMb);
	const diskSize = Number(diskSizeInMb);
	const timeout = Number(timeoutInSeconds);

	if (!Number.isInteger(memorySize) || memorySize <= 0) {
		throw new Error(
			`Memory size must be a positive integer. Received: ${memorySizeInMb}`,
		);
	}

	if (!Number.isInteger(diskSize) || diskSize <= 0) {
		throw new Error(
			`Disk size must be a positive integer. Received: ${diskSizeInMb}`,
		);
	}

	if (!Number.isInteger(timeout) || timeout <= 0) {
		throw new Error(
			`Timeout must be a positive integer. Received: ${timeoutInSeconds}`,
		);
	}

	return innerSpeculateFunctionName({
		diskSizeInMb,
		memorySizeInMb,
		timeoutInSeconds,
	});
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pass a positive integer for diskSizeInMb (valid Lambda range is 512-10240 MB; Remotion requires a multiple of 1).
  2. Validate diskSizeInMb with validateDiskSizeInMb() for full type/NaN/finite/range/integer checks.
  3. Coerce string inputs with Number() and confirm Number.isInteger() before calling.

Example fix

// before
speculateFunctionName({ memorySizeInMb: 2048, diskSizeInMb: 0, timeoutInSeconds: 120 });

// after
speculateFunctionName({ memorySizeInMb: 2048, diskSizeInMb: 2048, timeoutInSeconds: 120 });
Defensive patterns

Strategy: validation

Validate before calling

const disk = Number(diskSizeInMb);
if (!Number.isInteger(disk) || disk <= 0) {
  throw new Error(`diskSizeInMb must be a positive integer, got ${diskSizeInMb}`);
}
speculateFunctionName({ memorySizeInMb, diskSizeInMb: disk, timeoutInSeconds });

Type guard

const isPositiveInteger = (v: unknown): v is number =>
  typeof v === 'number' && Number.isInteger(v) && v > 0;

Prevention

When it happens

Trigger: Calling speculateFunctionName with diskSizeInMb that Number() turns into a non-integer or a value <= 0 (e.g., 0, -512, 'big', undefined, 2048.7).

Common situations: Disk size passed as a string from config/env without coercion; accidentally passing a percentage or unit-bearing string; defaulting to 0 in a config factory.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/82617dfaf2ea80f9. Report an issue: GitHub.