remotion-dev/remotion · error · TypeError

Polling must be a number or null, got ${JSON.stringify(

Error message

Polling must be a number or null, got ${JSON.stringify(
				interval,
			)} instead.

What it means

`Config.setWebpackPollingInMilliseconds()` accepts either a number (poll interval in ms) or `null` (disable polling, use filesystem events). Anything else — string, boolean, undefined — throws a TypeError echoing the JSON representation.

Source

Thrown at packages/cli/src/config/webpack-poll.ts:7

const DEFAULT_WEBPACK_POLL = null;

let webpackPolling: number | null = DEFAULT_WEBPACK_POLL;

export const setWebpackPollingInMilliseconds = (interval: number | null) => {
	if (typeof interval !== 'number' && interval !== null) {
		throw new TypeError(
			`Polling must be a number or null, got ${JSON.stringify(
				interval,
			)} instead.`,
		);
	}

	webpackPolling = interval;
};

export const getWebpackPolling = () => {
	return webpackPolling;
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pass a number in milliseconds: `Config.setWebpackPollingInMilliseconds(500)`.
  2. Pass `null` explicitly to disable polling: `Config.setWebpackPollingInMilliseconds(null)`.
  3. Coerce env strings: `Config.setWebpackPollingInMilliseconds(env.POLL ? Number(env.POLL) : null)`.

Example fix

// before
Config.setWebpackPollingInMilliseconds(process.env.POLL);
// after
Config.setWebpackPollingInMilliseconds(
  process.env.POLL ? Number(process.env.POLL) : null,
);
Defensive patterns

Strategy: type-guard

Validate before calling

const raw = process.env.POLL;
const value = raw === undefined || raw === '' ? null : Number(raw);
if (value !== null && (typeof value !== 'number' || Number.isNaN(value))) {
  throw new Error(`POLL must be a number or null, got ${raw}`);
}
Config.setWebpackPollingInMilliseconds(value);

Type guard

const isPollInput = (v: unknown): v is number | null =>
  v === null || (typeof v === 'number' && Number.isFinite(v));

Prevention

When it happens

Trigger: Calling `Config.setWebpackPollingInMilliseconds('500')`, `setWebpackPollingInMilliseconds(true)`, or `setWebpackPollingInMilliseconds(undefined)`.

Common situations: Env-driven polling value that arrives as a string; config file value quoted by mistake; passing `0` to mean 'off' (use `null` instead).

Related errors


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