{"record":{"id":"b495e72e8cd1dc77","repo":"remotion-dev/remotion","slug":"dotcolor-can-only-be-set-when-colormode-is-so","errorCode":null,"errorMessage":"\"dotColor\" can only be set when \"colorMode\" is \"solid\"","messagePattern":"\"dotColor\" can only be set when \"colorMode\" is \"solid\"","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/halftone-linear-gradient.ts","lineNumber":241,"sourceCode":"\nconst validateHalftoneLinearGradientParams = (\n\tparams: HalftoneLinearGradientParams,\n): void => {\n\tassertEffectParamsObject(params, 'Halftone linear gradient');\n\tassertOptionalFiniteNumber(params.firstStopDotSize, 'firstStopDotSize');\n\tassertOptionalFiniteNumber(params.secondStopDotSize, 'secondStopDotSize');\n\tassertOptionalUvCoordinate(params.firstStopPosition, 'firstStopPosition');\n\tassertOptionalUvCoordinate(params.secondStopPosition, 'secondStopPosition');\n\tassertOptionalFiniteNumber(params.gridSize, 'gridSize');\n\tassertOptionalBoolean(params.maskToSourceAlpha, 'maskToSourceAlpha');\n\tassertOptionalEnum(\n\t\tparams.colorMode,\n\t\t'colorMode',\n\t\tHALFTONE_LINEAR_GRADIENT_COLOR_MODES,\n\t);\n\n\tif (params.colorMode === 'source' && 'dotColor' in params) {\n\t\tthrow new TypeError(\n\t\t\t'\"dotColor\" can only be set when \"colorMode\" is \"solid\"',\n\t\t);\n\t}\n\n\tassertOptionalColor(\n\t\t'dotColor' in params ? params.dotColor : undefined,\n\t\t'dotColor',\n\t);\n\n\tif (params.firstStopDotSize !== undefined) {\n\t\tvalidateNonNegative(params.firstStopDotSize, 'firstStopDotSize');\n\t}\n\n\tif (params.secondStopDotSize !== undefined) {\n\t\tvalidateNonNegative(params.secondStopDotSize, 'secondStopDotSize');\n\t}\n\n\tif (params.gridSize !== undefined) {","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/halftone-linear-gradient.ts#L223-L259","documentation":"TypeError thrown by halftone-linear-gradient when colorMode is 'source' but a dotColor prop is also present. In 'source' mode the dots sample their color from the underlying video, so a separate dotColor is meaningless and would be silently ignored — the library rejects it to prevent confusion. Note the check uses 'dotColor' in params, so explicitly passing dotColor: undefined still counts as 'present'.","triggerScenarios":"validateHalftoneLinearGradientParams (line 240) throws when params.colorMode === 'source' AND 'dotColor' is an own property of params. Triggered by: <halftoneLinearGradient colorMode=\"source\" dotColor=\"#fff\" />, or programmatically passing {colorMode:'source', dotColor: undefined}.","commonSituations":"Switching colorMode to 'source' in a shared config but forgetting to remove dotColor; conditionally spreading a dotColor prop that ends up on the object even when colorMode is 'source'; copying props from a 'solid' preset.","solutions":["Remove dotColor when colorMode is 'source'.","Conditionally include dotColor only for 'solid': {colorMode, ...(colorMode==='solid' ? {dotColor} : {})}.","If you need custom colors, keep colorMode as 'solid' and set dotColor."],"exampleFix":"// before\n<halftoneLinearGradient colorMode=\"source\" dotColor=\"#ff00aa\" />\n// -> \"dotColor\" can only be set when \"colorMode\" is \"solid\"\n\n// after (source mode)\n<halftoneLinearGradient colorMode=\"source\" />\n\n// after (solid mode keeps the color)\n<halftoneLinearGradient colorMode=\"solid\" dotColor=\"#ff00aa\" />","handlingStrategy":"validation","validationCode":"// Only attach dotColor when colorMode is 'solid'\nconst colorMode: 'solid' | 'source' = 'solid';\nconst props = {colorMode, ...(colorMode === 'solid' ? {dotColor: '#ff00aa'} : {})};","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Conditionally spread dotColor only for 'solid' mode.","Do not pass dotColor: undefined in 'source' mode (it still counts as present).","Keep presets per colorMode to avoid cross-contamination.","Run validateParams to catch the conflict before render."],"tags":["halftone-linear-gradient-effect","validation","typescript","params","mutual-exclusion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}