remotion-dev/remotion · critical · Error

Failed to create WebGL buffer

Error message

Failed to create WebGL buffer

What it means

Thrown when `gl.createBuffer()` returns null while allocating the fullscreen-quad vertex buffer for lightTrail. Buffer object exhaustion or context loss are the only spec-compliant causes.

Source

Thrown at packages/effects/src/light-trail/light-trail-runtime.ts:127

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl, LIGHT_TRAIL_VS, LIGHT_TRAIL_FS);

	const vao = gl.createVertexArray();
	if (!vao) {
		throw new Error('Failed to create WebGL vertex array');
	}

	gl.bindVertexArray(vao);

	const data = new Float32Array([
		-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,
	]);

	const vbo = gl.createBuffer();
	if (!vbo) {
		throw new Error('Failed to create WebGL buffer');
	}

	gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
	gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);

	gl.enableVertexAttribArray(0);
	gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 16, 0);
	gl.enableVertexAttribArray(1);
	gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 16, 8);

	gl.bindVertexArray(null);

	const colorCanvas = document.createElement('canvas');
	colorCanvas.width = 1;
	colorCanvas.height = 1;
	const colorCtx = colorCanvas.getContext('2d', {willReadFrequently: true});
	if (!colorCtx) {
		throw new Error('Failed to acquire 2D context for color parsing');

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pair `setupLightTrail` with `cleanupLightTrail` so VBOs are freed.
  2. Recover on `webglcontextrestored` instead of retrying immediately.
  3. Limit stacked WebGL effects per frame.
  4. Restart workers that accumulate GL handles over time.
Defensive patterns

Strategy: fallback

Try / catch

try {
  setupLightTrail(canvas);
} catch (err) {
  renderWithoutEffect();
}

Prevention

When it happens

Trigger: Many effects each allocating VBOs without cleanup; setup on a lost context; GL buffer-handle exhaustion on a constrained driver.

Common situations: Long-lived render sessions that leak buffers; Studio hot-reload loops that re-setup without teardown; constrained embedded GPUs.

Related errors


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