remotion-dev/remotion · critical · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

While setting up the mirror effect's geometry, gl.createVertexArray() returned null. The WebGL2 context exists (program and shaders are already created) but cannot allocate a VAO. This indicates context degradation, resource limits, or driver issues.

Source

Thrown at packages/effects/src/mirror/mirror-runtime.ts:109

};

export const setupMirror = (target: HTMLCanvasElement): MirrorState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) {
		throw createWebGL2ContextError('mirror effect');
	}

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl, MIRROR_VS, MIRROR_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. Ensure the environment fully supports WebGL2 VAOs — update GPU drivers.
  2. Handle WebGL context loss and retry the render.
  3. For headless/CI rendering, verify Chrome's GPU configuration.
  4. Reduce concurrent WebGL effect usage.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  // apply mirror effect
} catch (e) {
  if (e instanceof Error && e.message.includes('WebGL vertex array')) {
    console.warn('WebGL VAO creation failed, skipping mirror effect');
    // fallback path
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: During setupMirror, after createProgram succeeds, gl.createVertexArray() returns null. The vertex array object is needed to encapsulate the vertex attribute bindings for the fullscreen quad.

Common situations: Context loss during setup; GPU driver hitting VAO allocation limits; headless environments with incomplete WebGL2 VAO support; very old GPU hardware.

Related errors


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