remotion-dev/remotion · error · TypeError
"scale" must be greater than 0, but got ${JSON.stringify(r.s
Error message
"scale" must be greater than 0, but got ${JSON.stringify(r.scale)} What it means
Thrown by an explicit inline check in validatePaperParams (packages/effects/src/paper.ts:321) when the resolved scale is ≤ 0. scale controls the paper-pattern zoom (documented 0.01–4) and is used as a divisor in the shader (max(uScale, 0.001)), so zero/negative is rejected before setup to avoid a degenerate render.
Source
Thrown at packages/effects/src/paper.ts:321
assertOptionalFiniteNumber(params.scale, 'scale');
const r = resolve(params);
validateUnitInterval(r.amount, 'amount');
validateUnitInterval(r.contrast, 'contrast');
validateUnitInterval(r.roughness, 'roughness');
validateUnitInterval(r.fiber, 'fiber');
validatePositiveUnitInterval(r.fiberSize, 'fiberSize');
validateUnitInterval(r.crumples, 'crumples');
validatePositiveUnitInterval(r.crumpleSize, 'crumpleSize');
validateUnitInterval(r.folds, 'folds');
validateNonNegative(r.foldCount, 'foldCount');
validateAtMost(r.foldCount, MAX_FOLD_COUNT, 'foldCount');
validateUnitInterval(r.drops, 'drops');
validateUnitInterval(r.fade, 'fade');
validateNonNegative(r.seed, 'seed');
validateAtMost(r.seed, MAX_SEED, 'seed');
if (r.scale <= 0) {
throw new TypeError(
`"scale" must be greater than 0, but got ${JSON.stringify(r.scale)}`,
);
}
validateAtMost(r.scale, 4, 'scale');
};
const PAPER_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);
}
`;
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Set scale to a positive value in (0, 4] (minimum 0.01).
- Clamp animations to a small positive floor: Math.max(0.01, value) or interpolate with extrapolateLeft: 'clamp'.
- Pre-validate scale > 0 with the guard below.
Example fix
// before
paper({scale: 0}); // throws
// after
paper({scale: 0.01}); Defensive patterns
Strategy: validation
Validate before calling
// Ensure scale is in (0, 4]
function sanitizePaperScale(v: number | undefined): number | undefined {
if (v === undefined) return undefined;
if (typeof v !== 'number' || !Number.isFinite(v) || v <= 0) return 0.01;
return Math.min(v, 4);
}
// usage: paper({scale: sanitizePaperScale(raw.scale)}) Type guard
const isValidPaperScale = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v) && v > 0 && v <= 4;
Try / catch
try {
paper({scale: raw.scale});
} catch (err) {
if (err instanceof TypeError && /"scale" must be greater than 0/.test(err.message)) {
paper({scale: Math.max(0.01, raw.scale)});
} else throw err;
} Prevention
- Floor animated scale at 0.01 with Math.max or extrapolateLeft: 'clamp'.
- Validate externally sourced scale before calling paper().
- Ensure UI scale controls start above zero.
When it happens
Trigger: Calling paper({scale: 0}) or paper({scale: -1}); animating scale down to zero without clamping.
Common situations: An interpolate ramping scale to 0; a UI default of 0 copied into params; math producing 0 from a division.
Related errors
- "${name}" must be <= ${max}, but got ${JSON.stringify(value)
- "${name}" must be greater than 0, but got ${JSON.stringify(v
- "${name}" must be between ${min} and ${max}
- "${name}" must be greater than 0, but got ${JSON.stringify(v
- "${name}" must be greater than or equal to 0, but got ${JSON
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/db3492efc4f5dc1a.
Report an issue: GitHub.