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 validatePositive() during waves() effect param validation. The waves effect requires thickness and wavelength to be strictly positive (> 0). This TypeError fires when either value resolves to 0 or a negative number after applying defaults. The error message names which field is invalid and shows the offending value.
Source
Thrown at packages/effects/src/waves.ts:211
phase: p.phase ?? DEFAULT_PHASE,
maskToSourceAlpha: p.maskToSourceAlpha ?? DEFAULT_MASK_TO_SOURCE_ALPHA,
};
};
const formatEnum = (variants: readonly string[]): string => {
if (variants.length === 2) {
return `"${variants[0]}" or "${variants[1]}"`;
}
return `${variants
.slice(0, -1)
.map((variant) => `"${variant}"`)
.join(', ')} or "${variants[variants.length - 1]}"`;
};
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 validateNonNegative = (value: number, name: string): void => {
if (value < 0) {
throw new TypeError(
`"${name}" must be greater than or equal to 0, but got ${JSON.stringify(value)}`,
);
}
};
const validateColors = (colors: unknown): void => {
if (colors === undefined) {
return;
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Set thickness to a small positive value (e.g., 0.1, the schema minimum) instead of 0.
- If you want no visible stripes, remove the waves() effect from that frame's filter chain rather than zeroing thickness.
- If animating, clamp the interpolated value with Math.max(0.1, value) before passing it.
- For wavelength, use Math.max(1, value) since the schema minimum is 1.
Example fix
// before
import {waves} from '@remotion/effects';
waves({thickness: 0}) // throws
waves({wavelength: 0}) // throws
// after
waves({thickness: 0.1}) // thinnest allowed
waves({wavelength: 1}) // shortest allowed
// animating with a safe clamp
waves({
thickness: Math.max(0.1, spring({frame, fps, config})),
}) Defensive patterns
Strategy: validation
Validate before calling
import type {WavesParams} from '@remotion/effects';
const validateWavesPositive = (params: WavesParams): void => {
if (params.thickness !== undefined && params.thickness <= 0) {
throw new Error(`thickness must be > 0, got ${params.thickness}`);
}
if (params.wavelength !== undefined && params.wavelength <= 0) {
throw new Error(`wavelength must be > 0, got ${params.wavelength}`);
}
};
// Run before calling waves()
validateWavesPositive({thickness: myThickness, wavelength: myWavelength}); Type guard
const isPositiveNumber = (v: unknown): v is number =>
typeof v === 'number' && Number.isFinite(v) && v > 0;
const hasValidPositiveParams = (params: {
thickness?: number;
wavelength?: number;
}): boolean =>
(params.thickness === undefined || isPositiveNumber(params.thickness)) &&
(params.wavelength === undefined || isPositiveNumber(params.wavelength)); Prevention
- Clamp animated values: Math.max(0.1, thickness) and Math.max(1, wavelength).
- Use the schema min values (0.1 for thickness, 1 for wavelength) as hard floors.
- When interpolating, ensure the easing function never crosses zero.
When it happens
Trigger: Called from validateWavesParams() at packages/effects/src/waves.ts:274 (validatePositive(thickness, 'thickness')) and line 277 (validatePositive(wavelength, 'wavelength')). Fires when you pass waves({thickness: 0}) or waves({thickness: -5}) or waves({wavelength: 0}) or waves({wavelength: -10}). Note defaults are thickness=40 and wavelength=160, so this only triggers when you explicitly pass a non-positive value.
Common situations: Passing thickness: 0 trying to make stripes invisible (use gap or remove the effect instead); animating wavelength toward 0 and hitting zero on a frame; passing negative values by mistake from a computed expression; confusing thickness with gap semantics.
Related errors
- "${name}" must be greater than or equal to 0, but got ${JSON
- "colors" must be an array with at least 2 colors, but got ${
- "direction" must be ${formatEnum(WAVE_DIRECTIONS)}, but got
- "invert" must be a boolean, but got ${JSON.stringify(params.
- "${name}" must be a [number, number] tuple
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/dc2fa6749021f8d5.
Report an issue: GitHub.