remotion-dev/remotion · error · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

Thrown inside `lightLeak`'s setup when `gl.createVertexArray()` returns `null`. The light-leak VAO (capturing the fullscreen quad's position/UV attributes) could not be allocated, indicating context loss or GPU object-slot/memory exhaustion.

Source

Thrown at packages/effects/src/light-leak.ts:256

			premultipliedAlpha: true,
			alpha: true,
			preserveDrawingBuffer: true,
		});
		if (!gl) {
			throw createWebGL2ContextError('light leak effect');
		}

		gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

		const vs = compileShader(gl, gl.VERTEX_SHADER, LIGHT_LEAK_VS);
		const fs = compileShader(gl, gl.FRAGMENT_SHADER, LIGHT_LEAK_FS);
		const program = linkProgram(gl, vs, fs);
		gl.deleteShader(vs);
		gl.deleteShader(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);

		const aPos = gl.getAttribLocation(program, 'aPos');
		const aUv = gl.getAttribLocation(program, 'aUv');

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Lower concurrency and reuse/dispose VAOs.
  2. Handle context loss and recreate the effect on restore.
  3. Restart Chrome/GPU to clear leaked objects.
  4. Use a GPU-backed render environment.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  lightLeak({...})(...);
} catch (err) {
  if (/Failed to create WebGL vertex array/.test(String(err))) {
    console.warn('lightLeak() VAO unavailable', err);
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Context lost before VAO creation; too many VAOs across concurrent effects; software renderer refusing a VAO; VRAM exhaustion.

Common situations: Concurrent renders; backgrounded tabs; memory-constrained environments.

Related errors


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