remotion-dev/remotion · error · TypeError
"${name}" must be a boolean, but got ${JSON.stringify(value)
Error message
"${name}" must be a boolean, but got ${JSON.stringify(value)} What it means
Thrown by assertOptionalBoolean (packages/effects/src/noise.ts:79), reached via validateNoiseParams only for params.premultiply. It fires when premultiply is defined but not a boolean (e.g. the string "true", 1, or null). amount and seed use a different validator, so this specific message is exclusively the premultiply field of the noise() effect.
Source
Thrown at packages/effects/src/noise.ts:79
readonly uResolution: WebGLUniformLocation | null;
readonly uAmount: WebGLUniformLocation | null;
readonly uSeed: WebGLUniformLocation | null;
readonly uPremultiply: WebGLUniformLocation | null;
};
const resolve = (p: NoiseParams): NoiseResolved => ({
amount: p.amount ?? DEFAULT_AMOUNT,
seed: p.seed ?? DEFAULT_SEED,
premultiply: p.premultiply ?? DEFAULT_PREMULTIPLY,
});
const assertOptionalBoolean = (value: unknown, name: string): void => {
if (value === undefined) {
return;
}
if (typeof value !== 'boolean') {
throw new TypeError(
`"${name}" must be a boolean, but got ${JSON.stringify(value)}`,
);
}
};
const validateNoiseParams = (params: NoiseParams): void => {
assertEffectParamsObject(params, 'Noise');
assertOptionalFiniteNumber(params.amount, 'amount');
assertOptionalFiniteNumber(params.seed, 'seed');
assertOptionalBoolean(params.premultiply, 'premultiply');
const r = resolve(params);
validateUnitInterval(r.amount, 'amount');
};
const NOISE_VS = /* glsl */ `#version 300 es
in vec2 aPos;
in vec2 aUv;View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Pass an actual boolean (or omit premultiply for the default false): noise({premultiply: true}).
- Coerce at the boundary: convert 'true'/'false' strings and 0/1 to booleans before handing params to noise().
- Run the type guard below on deserialized params so bad data is rejected before the effect call.
Example fix
// before
noise({amount: 0.2, premultiply: 'true'}); // throws TypeError
// after
noise({amount: 0.2, premultiply: true}); Defensive patterns
Strategy: validation
Validate before calling
// Validate a deserialized noise params object before calling noise()
function isValidNoisePremultiply(p: unknown): boolean {
if (p === undefined) return true;
return typeof p === 'boolean';
}
function sanitizeNoisePremultiply(p: unknown): boolean | undefined {
if (p === undefined) return undefined;
if (typeof p === 'boolean') return p;
if (p === 'true') return true;
if (p === 'false') return false;
if (p === 1) return true;
if (p === 0) return false;
throw new TypeError('premultiply must be a boolean');
} Type guard
const isNoisePremultiply = (v: unknown): v is boolean | undefined => v === undefined || typeof v === 'boolean';
Try / catch
try {
noise({premultiply: raw as boolean});
} catch (err) {
if (err instanceof TypeError && /premultiply.*boolean/.test(err.message)) {
noise({premultiply: Boolean(raw)}); // coerce and retry
} else throw err;
} Prevention
- Keep premultiply as a real boolean in config sources, not a string.
- Validate params at the deserialization boundary (JSON, query string, env).
- Let TypeScript's NoiseParams type guide callers; do not bypass it with any.
When it happens
Trigger: Calling noise({premultiply: 'true'}), noise({premultiply: 1}), noise({premultiply: null}), or any value where typeof premultiply !== 'boolean' and !== 'undefined'. Serializing params from JSON (where booleans may arrive as strings) is a frequent producer.
Common situations: Reading effect params from a config file, URL query string, or server JSON where booleans get coerced to strings/numbers; passing a tri-state null intending 'default'.
Related errors
- "${name}" must be greater than 0, but got ${JSON.stringify(v
- "${name}" must be greater than or equal to 0, but got ${JSON
- "colors" must be an array with at least 2 colors, but got ${
- "${name}" must be greater than 0, but got ${JSON.stringify(v
- "${name}" must be ${formatEnum(variants)}, but got ${JSON.st
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/4517f706fcfee32d.
Report an issue: GitHub.