remotion-dev/remotion · error · Error

Timeout must be a positive integer. Received: ${timeoutInSec

Error message

Timeout must be a positive integer. Received: ${timeoutInSeconds}

What it means

speculateFunctionName validates timeoutInSeconds as a positive integer after Number() coercion. A non-integer, zero, negative, or non-numeric value triggers this error.

Source

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

}: 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 number of seconds (Lambda max is 900; Remotion typically uses 120-900).
  2. Strip unit suffixes before calling, and coerce with Number().
  3. Validate with Number.isInteger() and > 0 before speculateFunctionName.

Example fix

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

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

Strategy: validation

Validate before calling

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

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 timeoutInSeconds that Number() cannot turn into a positive integer (e.g., 0, -10, 120.5, 'two-minutes', undefined).

Common situations: Passing timeout as a string like '120s' instead of the integer 120; using a fractional second value; defaulting to 0; confusing seconds with milliseconds.

Understand the failure class

Related errors


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