{"record":{"id":"4517f706fcfee32d","repo":"remotion-dev/remotion","slug":"name-must-be-a-boolean-but-got-json-string-4517f7","errorCode":null,"errorMessage":"\"${name}\" must be a boolean, but got ${JSON.stringify(value)}","messagePattern":"\"(.+?)\" must be a boolean, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/noise.ts","lineNumber":79,"sourceCode":"\treadonly uResolution: WebGLUniformLocation | null;\n\treadonly uAmount: WebGLUniformLocation | null;\n\treadonly uSeed: WebGLUniformLocation | null;\n\treadonly uPremultiply: WebGLUniformLocation | null;\n};\n\nconst resolve = (p: NoiseParams): NoiseResolved => ({\n\tamount: p.amount ?? DEFAULT_AMOUNT,\n\tseed: p.seed ?? DEFAULT_SEED,\n\tpremultiply: p.premultiply ?? DEFAULT_PREMULTIPLY,\n});\n\nconst assertOptionalBoolean = (value: unknown, name: string): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'boolean') {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be a boolean, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nconst validateNoiseParams = (params: NoiseParams): void => {\n\tassertEffectParamsObject(params, 'Noise');\n\tassertOptionalFiniteNumber(params.amount, 'amount');\n\tassertOptionalFiniteNumber(params.seed, 'seed');\n\tassertOptionalBoolean(params.premultiply, 'premultiply');\n\n\tconst r = resolve(params);\n\tvalidateUnitInterval(r.amount, 'amount');\n};\n\nconst NOISE_VS = /* glsl */ `#version 300 es\nin vec2 aPos;\nin vec2 aUv;","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/noise.ts#L61-L97","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","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."],"exampleFix":"// before\nnoise({amount: 0.2, premultiply: 'true'}); // throws TypeError\n\n// after\nnoise({amount: 0.2, premultiply: true});","handlingStrategy":"validation","validationCode":"// Validate a deserialized noise params object before calling noise()\nfunction isValidNoisePremultiply(p: unknown): boolean {\n  if (p === undefined) return true;\n  return typeof p === 'boolean';\n}\n\nfunction sanitizeNoisePremultiply(p: unknown): boolean | undefined {\n  if (p === undefined) return undefined;\n  if (typeof p === 'boolean') return p;\n  if (p === 'true') return true;\n  if (p === 'false') return false;\n  if (p === 1) return true;\n  if (p === 0) return false;\n  throw new TypeError('premultiply must be a boolean');\n}","typeGuard":"const isNoisePremultiply = (v: unknown): v is boolean | undefined =>\n  v === undefined || typeof v === 'boolean';","tryCatchPattern":"try {\n  noise({premultiply: raw as boolean});\n} catch (err) {\n  if (err instanceof TypeError && /premultiply.*boolean/.test(err.message)) {\n    noise({premultiply: Boolean(raw)}); // coerce and retry\n  } else throw err;\n}","preventionTips":["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."],"tags":["validation","params","noise","effects","typescript"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}