{"record":{"id":"fbd055219a1f3c60","repo":"remotion-dev/remotion","slug":"name-must-be-a-non-empty-string-but-got-js","errorCode":null,"errorMessage":"\"${name}\" must be a non-empty string, but got ${JSON.stringify(value)}","messagePattern":"\"(.+?)\" must be a non-empty string, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/validate-effect-param.ts","lineNumber":25,"sourceCode":"\t\t\t`${effectLabel} effect requires a parameters object, but got ${JSON.stringify(params)}`,\n\t\t);\n\t}\n};\n\nexport const assertRequiredFiniteNumber = (\n\tvalue: unknown,\n\tname: string,\n): void => {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be a finite number, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nexport const assertRequiredColor = (value: unknown, name: string): void => {\n\tif (typeof value !== 'string' || value.length === 0) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be a non-empty string, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nexport const assertOptionalColor = (value: unknown, name: string): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tassertRequiredColor(value, name);\n};\n\nexport const assertOptionalBoolean = (value: unknown, name: string): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/validate-effect-param.ts#L7-L43","documentation":"Thrown by assertRequiredColor when a color parameter is not a string or is an empty string. This validator backs the required color params of effects like tint (color), lines/waves/checkerboard (colors[i] in a loop). The empty-string check catches the common mistake of passing '' as a default. assertOptionalColor delegates here for non-undefined values, so effects like vignette, drop-shadow, gridlines, contour-lines, and halftone-linear-gradient also trigger this for their optional color fields.","triggerScenarios":"Calling tint({color: ''}), tint({color: null}), tint({color: '#ff0'}), or passing a non-string (number, object) as a color. Also triggered via assertOptionalColor when an optional color field is set to '' or a non-string — e.g. vignette({color: 0}).","commonSituations":"Color value comes from a config file or CMS where it was left blank; developer passes a hex number (0xff0000) instead of a hex string ('#ff0000'); optional color field defaults to '' instead of undefined; data deserialized from JSON where the field is null.","solutions":["Pass a valid CSS color string: tint({color: '#ff0000'}) or tint({color: 'red'})","If the color may be absent, omit the field entirely (set to undefined, not '') so optional validators skip it","Validate color strings before passing: ensure typeof color === 'string' && color.length > 0","Convert numeric hex to string: '#' + value.toString(16).padStart(6, '0')"],"exampleFix":"// before\nconst e = tint({color: ''});\n\n// after\nconst e = tint({color: '#ff0000'});","handlingStrategy":"validation","validationCode":"function isValidColor(value: unknown): boolean {\n  return typeof value === 'string' && value.length > 0;\n}\n\n// Before calling:\nif (!isValidColor(params.color)) {\n  throw new Error('color must be a non-empty CSS color string');\n}\nconst e = tint({color: params.color});","typeGuard":"function isNonEmptyString(value: unknown): value is string {\n  return typeof value === 'string' && value.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Pass CSS color strings like '#ff0000' or 'rgb(255,0,0)' — never numbers or empty strings","For optional color fields, omit the key (set to undefined) rather than passing ''","Validate color strings from external/CMS data before passing to effects","Convert numeric hex to string format: '#' + num.toString(16).padStart(6, '0')"],"tags":["validation","typescript","params","typeerror","color","shared-helper"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}