{"record":{"id":"130182e08a41c852","repo":"remotion-dev/remotion","slug":"name-params-must-be-an-object","errorCode":null,"errorMessage":"${name} params must be an object","messagePattern":"(.+?) params must be an object","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/brand/src/effects/metallic-swirl-effect.ts","lineNumber":268,"sourceCode":"\tcolorPhaseR: params.colorPhaseR ?? DEFAULT_COLOR_PHASE,\n\tcolorPhaseG: params.colorPhaseG ?? DEFAULT_COLOR_PHASE,\n\tcolorPhaseB: params.colorPhaseB ?? DEFAULT_COLOR_PHASE,\n\tcolorRange: params.colorRange ?? DEFAULT_COLOR_RANGE,\n\tcolorBias: params.colorBias ?? DEFAULT_COLOR_BIAS,\n\tcolorA: params.colorA ?? DEFAULT_COLOR_A,\n\tcolorB: params.colorB ?? DEFAULT_COLOR_B,\n\tbrightness: params.brightness ?? DEFAULT_BRIGHTNESS,\n\tbackgroundColor: params.backgroundColor ?? DEFAULT_BACKGROUND_COLOR,\n\topacity: params.opacity ?? DEFAULT_OPACITY,\n\tmode: params.mode ?? DEFAULT_MODE,\n});\n\nconst assertParamsObject = (\n\tparams: MetallicSwirlParams,\n\tname: string,\n): void => {\n\tif (params === null || typeof params !== 'object' || Array.isArray(params)) {\n\t\tthrow new TypeError(`${name} params must be an object`);\n\t}\n};\n\nconst assertOptionalFiniteNumber = (\n\tvalue: unknown,\n\tname: keyof MetallicSwirlParams,\n): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\tthrow new TypeError(`\"${name}\" must be a finite number`);\n\t}\n};\n\nconst validateRange = (\n\tvalue: number,","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/brand/src/effects/metallic-swirl-effect.ts#L250-L286","documentation":"`assertParamsObject` runs at the top of `validateMetallicSwirlParams` and rejects a params value that is not a plain object: `null`, an array, a primitive (string/number/boolean), or `typeof !== 'object'`. Because `MetallicSwirlParams` declares all keys optional, callers sometimes pass a non-object that still satisfies loose typing; this guard stops it before any key is read.","triggerScenarios":"Calling `metallicSwirl(null)`, `metallicSwirl(undefined)` is fine (defaulted to `{}`), but `metallicSwirl(null)` is not; `metallicSwirl([])`, `metallicSwirl('blend')`, `metallicSwirl(5)`, or passing a serialized JSON string instead of a parsed object.","commonSituations":"Forwarding a deserialized value that was not parsed (`JSON.parse` skipped); passing a single default name as a string; spreading an array into the effect; receiving params from an untyped boundary (postMessage, URL query).","solutions":["Pass a plain object: `metallicSwirl({})` or `metallicSwirl({speed: 2})`.","If the value comes from JSON, call `JSON.parse` first and ensure the result is a non-array object.","Coerce at the boundary: `const p = (v && typeof v === 'object' && !Array.isArray(v)) ? v : {};`.","Type the params variable as `MetallicSwirlParams` so TypeScript flags non-objects."],"exampleFix":"// before\nconst e = metallicSwirl(rawConfig); // rawConfig is a JSON string\n\n// after\nconst parsed = JSON.parse(rawConfig);\nconst e = metallicSwirl(parsed);","handlingStrategy":"type-guard","validationCode":"// Ensure params is a plain object before passing to metallicSwirl.\nconst asParamsObject = (v: unknown): Record<string, unknown> => {\n  if (v === null || typeof v !== 'object' || Array.isArray(v)) {\n    return {}; // or throw, depending on desired strictness\n  }\n  return v as Record<string, unknown>;\n};\nmetallicSwirl(asParamsObject(rawConfig));","typeGuard":"const isPlainObject = (v: unknown): v is Record<string, unknown> =>\n  v !== null && typeof v === 'object' && !Array.isArray(v);","tryCatchPattern":null,"preventionTips":["Always pass a plain object literal to metallicSwirl, even if empty.","Parse JSON config before forwarding (`JSON.parse`), and check the result is a non-array object.","Type the params variable as `MetallicSwirlParams` to catch non-objects at compile time.","Do not forward values from `postMessage`/URL queries without a shape check."],"tags":["brand","metallic-swirl","validation","params","runtime"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}