remotion-dev/remotion · critical · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

Thrown when `gl.createVertexArray()` returns null during lightTrail setup. The VAO bundles the fullscreen-quad vertex format. Like other GL allocations, null only occurs on context loss or handle exhaustion.

Source

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

};

export const setupLightTrail = (target: HTMLCanvasElement): LightTrailState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) {
		throw createWebGL2ContextError('light trail effect');
	}

	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);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Share/cleanup state aggressively; pair every setup with cleanup.
  2. Listen for and recover from `webglcontextlost`.
  3. Reduce the number of simultaneously active WebGL effects per canvas.
  4. Restart the render worker if a session shows progressive GL handle growth.
Defensive patterns

Strategy: fallback

Try / catch

try {
  setupLightTrail(canvas);
} catch (err) {
  // VAO exhaustion or context loss — degrade to non-effect render
  renderWithoutEffect();
}

Prevention

When it happens

Trigger: VAO handle exhaustion from many concurrent WebGL effects; setup called on an already-lost context; a driver limit on VAO objects reached.

Common situations: Dozens of effects each holding a VAO on the same context; headless Chromium leaking VAOs; render worker reusing a long-lived context.

Related errors


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