remotion-dev/remotion · error · TypeError

"size" must be greater than 0, but got ${JSON.stringify(reso

Error message

"size" must be greater than 0, but got ${JSON.stringify(resolved.size)}

What it means

Thrown by validateFlannelParams when the resolved flannel 'size' is <= 0. 'size' is the spacing (in pixels) of the woven plaid pattern; zero or negative spacing would divide by zero inside the shader's repeating coordinates. amount and softness are unit-interval values validated separately.

Source

Thrown at packages/effects/src/flannel.ts:117

	size: params.size ?? DEFAULT_SIZE,
	softness: params.softness ?? DEFAULT_SOFTNESS,
	baseColor: params.baseColor ?? DEFAULT_BASE_COLOR,
	stripeColor: params.stripeColor ?? DEFAULT_STRIPE_COLOR,
});

const validateFlannelParams = (params: FlannelParams): void => {
	assertEffectParamsObject(params, 'Flannel');
	assertOptionalFiniteNumber(params.amount, 'amount');
	assertOptionalFiniteNumber(params.size, 'size');
	assertOptionalFiniteNumber(params.softness, 'softness');
	assertOptionalColor(params.baseColor, 'baseColor');
	assertOptionalColor(params.stripeColor, 'stripeColor');

	const resolved = resolve(params);
	validateUnitInterval(resolved.amount, 'amount');
	validateUnitInterval(resolved.softness, 'softness');
	if (resolved.size <= 0) {
		throw new TypeError(
			`"size" must be greater than 0, but got ${JSON.stringify(resolved.size)}`,
		);
	}
};

const FLANNEL_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 FLANNEL_FS = /* glsl */ `#version 300 es
precision highp float;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pass a positive pixel size: flannel({size: 8}).
  2. Clamp animated size: Math.max(1, value).
  3. Omit size to use the documented default.

Example fix

// before
flannel({size: frame === 0 ? 0 : 8});
// after
flannel({size: Math.max(1, frame === 0 ? 4 : 8)});
Defensive patterns

Strategy: validation

Validate before calling

const size = animatedSize <= 0 ? 8 : animatedSize;
flannel({size});

Type guard

const isPositive = (v: unknown): v is number =>
  typeof v === 'number' && Number.isFinite(v) && v > 0;

Prevention

When it happens

Trigger: flannel({size: 0}), flannel({size: -10}), or computing size from an animation that reaches zero.

Common situations: Animation that ramps size down to zero for a 'pattern collapse' effect; passing a relative scale factor that can be zero; off-by-one default of 0 instead of a positive pixel value.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/ed826e29b61b6c53. Report an issue: GitHub.