remotion-dev/remotion · error · TypeError
"${name}" must be greater than 0, but got ${JSON.stringify(v
Error message
"${name}" must be greater than 0, but got ${JSON.stringify(value)} What it means
Thrown by the local validatePositive helper in contour-lines.ts when a resolved contour-lines parameter that must be strictly greater than 0 is given a zero or negative value. This applies to lineWidth, spacing, and scale after defaults are resolved. A value of exactly 0 is rejected (not just negatives), because zero-width lines, zero spacing, or zero scale would produce a degenerate invisible result.
Source
Thrown at packages/effects/src/contour-lines.ts:197
};
const resolve = (p: ContourLinesParams): ContourLinesResolved => ({
lineColor: p.lineColor ?? DEFAULT_LINE_COLOR,
lineWidth: p.lineWidth ?? DEFAULT_LINE_WIDTH,
spacing: p.spacing ?? DEFAULT_SPACING,
scale: p.scale ?? DEFAULT_SCALE,
complexity: p.complexity ?? DEFAULT_COMPLEXITY,
smoothness: p.smoothness ?? DEFAULT_SMOOTHNESS,
seed: p.seed ?? DEFAULT_SEED,
offsetX: p.offsetX ?? DEFAULT_OFFSET_X,
offsetY: p.offsetY ?? DEFAULT_OFFSET_Y,
opacity: p.opacity ?? DEFAULT_OPACITY,
maskToSourceAlpha: p.maskToSourceAlpha ?? DEFAULT_MASK_TO_SOURCE_ALPHA,
});
const validatePositive = (value: number, name: string): void => {
if (value <= 0) {
throw new TypeError(
`"${name}" must be greater than 0, but got ${JSON.stringify(value)}`,
);
}
};
const validateContourLinesParams = (params: ContourLinesParams): void => {
assertEffectParamsObject(params, 'Contour lines');
assertOptionalColor(params.lineColor, 'lineColor');
assertOptionalFiniteNumber(params.lineWidth, 'lineWidth');
assertOptionalFiniteNumber(params.spacing, 'spacing');
assertOptionalFiniteNumber(params.scale, 'scale');
assertOptionalFiniteNumber(params.complexity, 'complexity');
assertOptionalFiniteNumber(params.smoothness, 'smoothness');
assertOptionalFiniteNumber(params.seed, 'seed');
assertOptionalFiniteNumber(params.offsetX, 'offsetX');
assertOptionalFiniteNumber(params.offsetY, 'offsetY');
assertOptionalFiniteNumber(params.opacity, 'opacity');
assertOptionalBoolean(params.maskToSourceAlpha, 'maskToSourceAlpha');View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Ensure lineWidth, spacing, and scale are always > 0 — use a small positive floor like 0.001 instead of 0.
- To fade the contour lines effect in/out, animate the opacity parameter (valid range 0..1) rather than driving lineWidth or scale to zero.
- Clamp computed values: Math.max(0.001, value) before passing to contourLines().
- If animating with interpolate(), set the outputRange floor above zero.
Example fix
// before (lineWidth animates through 0, throwing)
contourLines({lineWidth: interpolate(frame, [0, 30], [0, 2])})
// after (use opacity for fade, keep lineWidth positive)
contourLines({
lineWidth: interpolate(frame, [0, 30], [0.01, 2]),
opacity: interpolate(frame, [0, 30], [0, 1], {extrapolateLeft: 'clamp'}),
}) Defensive patterns
Strategy: validation
Validate before calling
// Ensure strictly positive values for lineWidth, spacing, scale
const lineWidth = Math.max(0.001, computedLineWidth);
const spacing = Math.max(0.001, computedSpacing);
const scale = Math.max(0.001, computedScale);
contourLines({lineWidth, spacing, scale}); Type guard
const isStrictlyPositive = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v) && v > 0;
Prevention
- Animate opacity (0..1) to fade contour lines, never lineWidth/spacing/scale.
- Use a small positive floor (e.g. 0.001) instead of 0 for positive params.
- Clamp interpolate() outputRange above zero for lineWidth, spacing, scale.
- Remember that 0 is rejected, not just negatives.
When it happens
Trigger: Calling contourLines({lineWidth: 0}), contourLines({spacing: 0}), contourLines({scale: 0}), contourLines({lineWidth: -1}), contourLines({spacing: -5}), or contourLines({scale: 0.0001}) where the value rounds to or hits zero. Also triggered by interpolate() animating one of these params through zero.
Common situations: Animating lineWidth or spacing to fade the effect in/out by going to zero (use opacity instead); passing a computed scale factor that collapses to zero at certain frames; defaulting a parameter to 0 expecting it to mean 'disabled'; dividing by a large number producing a sub-normal result that resolves to 0.
Related errors
- "${name}" must be >= -1, but got ${JSON.stringify(value)}
- Failed to create WebGL shader
- Contour lines shader compile failed: ${log ?? '(no log)'}
- Failed to create WebGL program
- Contour lines program link failed: ${log ?? '(no log)'}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/9204898785f5b483.
Report an issue: GitHub.