{"record":{"id":"747e969e97bfb67c","repo":"remotion-dev/remotion","slug":"dotspacing-must-be-1-but-got-json-stringif","errorCode":null,"errorMessage":"\"dotSpacing\" must be >= 1, but got ${JSON.stringify(params.dotSpacing)}","messagePattern":"\"dotSpacing\" must be >= 1, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/halftone.ts","lineNumber":210,"sourceCode":"\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\tassertOptionalBoolean(params.invert, 'invert');\n\n\tif (params.dotSize !== undefined && params.dotSize < 1) {\n\t\tthrow new TypeError(\n\t\t\t`\"dotSize\" must be >= 1, but got ${JSON.stringify(params.dotSize)}`,\n\t\t);\n\t}\n\n\tif (params.dotSpacing !== undefined && params.dotSpacing < 1) {\n\t\tthrow new TypeError(\n\t\t\t`\"dotSpacing\" must be >= 1, but got ${JSON.stringify(params.dotSpacing)}`,\n\t\t);\n\t}\n};\n\nconst HALFTONE_VS = /* glsl */ `#version 300 es\nin vec2 aPos;\nin vec2 aUv;\nout vec2 vUv;\nvoid main() {\n\tvUv = aUv;\n\tgl_Position = vec4(aPos, 0.0, 1.0);\n}\n`;\n\nconst HALFTONE_FS = /* glsl */ `#version 300 es\nprecision highp float;\n","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/halftone.ts#L192-L228","documentation":"Thrown by validateHalftoneParams() when params.dotSpacing is a finite number but less than 1. dotSpacing sets the grid pitch (it defaults to dotSize when omitted); like dotSize it has a schema min of 1 and this guard enforces it at runtime, echoing the bad value in the message.","triggerScenarios":"Calling halftone({ dotSpacing: 0 }), halftone({ dotSpacing: 0.5 }), or halftone({ dotSpacing: -2 }). Non-finite values are caught earlier by assertOptionalFiniteNumber, so this only fires for finite sub-1 numbers.","commonSituations":"Animated dotSpacing that ramps to zero; expressions deriving dotSpacing from another value that can go below 1; sliders without a floor.","solutions":["Clamp dotSpacing to at least 1: Math.max(1, value).","Floor any keyframe that animates dotSpacing to 1.","Set the controlling slider's min to 1."],"exampleFix":"// before\nhalftone({ dotSpacing: scale * 0.2 })\n\n// after\nhalftone({ dotSpacing: Math.max(1, scale * 0.2) })","handlingStrategy":"validation","validationCode":"function clampDotSpacing(v: number | undefined): number | undefined {\n  return v === undefined ? undefined : Math.max(1, v);\n}\n// then: halftone({ dotSpacing: clampDotSpacing(rawSpacing) })","typeGuard":"function isValidDotSpacing(v: unknown): v is number {\n  return typeof v === 'number' && Number.isFinite(v) && v >= 1;\n}","tryCatchPattern":null,"preventionTips":["Clamp animated/computed dotSpacing with Math.max(1, value).","Set the controlling slider's min to 1 (matching the schema).","Remember dotSpacing defaults to dotSize when omitted — if you omit it, ensure dotSize itself is >= 1."],"tags":["halftone","validation","params","numeric","range"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}