{"record":{"id":"770d6b63d23d398c","repo":"remotion-dev/remotion","slug":"colora-must-be-a-string","errorCode":null,"errorMessage":"\"colorA\" must be a string","messagePattern":"\"colorA\" must be a string","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/brand/src/effects/metallic-swirl-effect.ts","lineNumber":351,"sourceCode":"\tassertOptionalFiniteNumber(params.gradientForce, 'gradientForce');\n\tassertOptionalFiniteNumber(params.colorPhaseR, 'colorPhaseR');\n\tassertOptionalFiniteNumber(params.colorPhaseG, 'colorPhaseG');\n\tassertOptionalFiniteNumber(params.colorPhaseB, 'colorPhaseB');\n\tassertOptionalFiniteNumber(params.colorRange, 'colorRange');\n\tassertOptionalFiniteNumber(params.colorBias, 'colorBias');\n\tassertOptionalFiniteNumber(params.brightness, 'brightness');\n\tassertOptionalFiniteNumber(params.opacity, 'opacity');\n\tassertOptionalEnum(params.mode, 'mode', MODES);\n\n\tif (\n\t\tparams.backgroundColor !== undefined &&\n\t\ttypeof params.backgroundColor !== 'string'\n\t) {\n\t\tthrow new TypeError('\"backgroundColor\" must be a string');\n\t}\n\n\tif (params.colorA !== undefined && typeof params.colorA !== 'string') {\n\t\tthrow new TypeError('\"colorA\" must be a string');\n\t}\n\n\tif (params.colorB !== undefined && typeof params.colorB !== 'string') {\n\t\tthrow new TypeError('\"colorB\" must be a string');\n\t}\n\n\tconst resolved = resolve(params);\n\tvalidateRange(resolved.speed, 'speed', 0, 10);\n\tvalidateRange(resolved.zoom, 'zoom', 0.01, 50);\n\tvalidateRange(resolved.iterations, 'iterations', 1, 12);\n\tvalidateRange(resolved.sampleGap, 'sampleGap', 0.0001, 1);\n\tvalidateRange(resolved.colorRange, 'colorRange', 0, 2);\n\tvalidateRange(resolved.colorBias, 'colorBias', 0, 2);\n\tvalidateRange(resolved.brightness, 'brightness', 0, 5);\n\tvalidateRange(resolved.opacity, 'opacity', 0, 1);\n\tparseHexColor(resolved.backgroundColor, 'backgroundColor');\n\tparseHexColor(resolved.colorA, 'colorA');\n\tparseHexColor(resolved.colorB, 'colorB');","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/brand/src/effects/metallic-swirl-effect.ts#L333-L369","documentation":"`validateMetallicSwirlParams` checks `colorA`: if present (`!== undefined`) it must be a `string`, else this throws. Runs before `parseHexColor`, so non-strings fail here and invalid-hex strings fail at error 30. The two color slots (colorA, colorB) are checked independently.","triggerScenarios":"`metallicSwirl({colorA: 0xff0038})`, `metallicSwirl({colorA: null})`, `metallicSwirl({colorA: [255, 0, 56]})`, `metallicSwirl({colorA: true})`.","commonSituations":"Numeric color codes from design systems; RGB tuples/arrays from color pickers; null meaning 'unset'; boolean flags.","solutions":["Pass a hex string: `metallicSwirl({colorA: '#ff0038'})`.","Omit the key to use the default color A.","Convert RGB tuples to `#RRGGBB` at your boundary.","Use `undefined`, not `null`, for 'unset'."],"exampleFix":"// before\nmetallicSwirl({colorA: [255, 0, 56]});\n\n// after\nconst toHex = (r, g, b) => '#' + [r, g, b].map(n => n.toString(16).padStart(2, '0')).join('');\nmetallicSwirl({colorA: toHex(255, 0, 56)});","handlingStrategy":"type-guard","validationCode":"const optionalString = (v: unknown): string | undefined => {\n  if (v === undefined || v === null) return undefined;\n  if (typeof v !== 'string') {\n    throw new Error('colorA must be a string');\n  }\n  return v;\n};\nmetallicSwirl({colorA: optionalString(raw.colorA)});","typeGuard":"const isOptionalString = (v: unknown): v is string =>\n  typeof v === 'string';","tryCatchPattern":null,"preventionTips":["Pass hex strings for colorA; convert RGB tuples to `#RRGGBB` first.","Omit the key to use the default colorA instead of passing null.","Type params as `MetallicSwirlParams` so non-strings fail at compile time.","Keep color picker output as hex strings end-to-end."],"tags":["brand","metallic-swirl","validation","color","params"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}