remotion-dev/remotion · error · TypeError

maxRetries should be an integer, but is ${maxRetries}.

Error message

maxRetries should be an integer, but is ${maxRetries}.

What it means

Thrown by validateMaxRetries() when maxRetries is a finite, non-negative number but not an integer (maxRetries % 1 !== 0). The Cloud Run retry logic requires a whole number of attempts, so fractional values like 1.5 are rejected.

Source

Thrown at packages/cloudrun/src/shared/validate-retries.ts:23

		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

  1. Round explicitly with Math.round(), Math.floor(), or Math.trunc() before passing.
  2. Re-express the computation so it yields a whole number (e.g. use a count, not a ratio).
  3. Validate with Number.isInteger() upstream.

Example fix

// before
const maxRetries = total * 0.1; // e.g. 1.5

// after
const maxRetries = Math.max(0, Math.round(total * 0.1));
Defensive patterns

Strategy: validation

Validate before calling

if (typeof maxRetries === 'number' && maxRetries % 1 !== 0) {
  throw new RangeError(`maxRetries must be an integer: ${maxRetries}`);
}

Type guard

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

Prevention

When it happens

Trigger: Passing a float such as 1.5 or 2.7 as maxRetries; dividing two integers that does not yield a whole number; reading a decimal from config.

Common situations: Computing retries as a ratio or percentage (e.g. attempts = total * 0.1); using a float where an integer count was intended.

Related errors


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