remotion-dev/remotion · error · TypeError
"dotSpacing" must be >= 1, but got ${JSON.stringify(params.d
Error message
"dotSpacing" must be >= 1, but got ${JSON.stringify(params.dotSpacing)} What it means
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.
Source
Thrown at packages/effects/src/halftone.ts:210
throw new TypeError(
'"dotColor" can only be set when "colorMode" is "solid"',
);
}
assertOptionalColor(
'dotColor' in params ? params.dotColor : undefined,
'dotColor',
);
assertOptionalBoolean(params.invert, 'invert');
if (params.dotSize !== undefined && params.dotSize < 1) {
throw new TypeError(
`"dotSize" must be >= 1, but got ${JSON.stringify(params.dotSize)}`,
);
}
if (params.dotSpacing !== undefined && params.dotSpacing < 1) {
throw new TypeError(
`"dotSpacing" must be >= 1, but got ${JSON.stringify(params.dotSpacing)}`,
);
}
};
const HALFTONE_VS = /* glsl */ `#version 300 es
in vec2 aPos;
in vec2 aUv;
out vec2 vUv;
void main() {
vUv = aUv;
gl_Position = vec4(aPos, 0.0, 1.0);
}
`;
const HALFTONE_FS = /* glsl */ `#version 300 es
precision highp float;
View on GitHub (pinned to 78fe4bb3fd)
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.
Example fix
// before
halftone({ dotSpacing: scale * 0.2 })
// after
halftone({ dotSpacing: Math.max(1, scale * 0.2) }) Defensive patterns
Strategy: validation
Validate before calling
function clampDotSpacing(v: number | undefined): number | undefined {
return v === undefined ? undefined : Math.max(1, v);
}
// then: halftone({ dotSpacing: clampDotSpacing(rawSpacing) }) Type guard
function isValidDotSpacing(v: unknown): v is number {
return typeof v === 'number' && Number.isFinite(v) && v >= 1;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Animated dotSpacing that ramps to zero; expressions deriving dotSpacing from another value that can go below 1; sliders without a floor.
Related errors
- "dotSize" must be >= 1, but got ${JSON.stringify(params.dotS
- "${name}" must be between ${min} and ${max}
- "stops" must be >= ${MIN_STOPS}, but got ${JSON.stringify(st
- "stops" must be <= ${MAX_STOPS}, but got ${JSON.stringify(st
- "${name}" must be ${formatEnum(variants)}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/747e969e97bfb67c.
Report an issue: GitHub.