remotion-dev/remotion · critical · Error

Failed to create WebGL buffer

Error message

Failed to create WebGL buffer

What it means

While creating the vertex buffer for the mirror effect's fullscreen quad, gl.createBuffer() returned null. The VAO and program were already created successfully, but buffer allocation failed — indicating context loss, resource exhaustion, or driver issues at the buffer level.

Source

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

	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);
	gl.enableVertexAttribArray(1);
	gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 16, 8);

	gl.bindVertexArray(null);

	const textureSource = createRgbaTexture(gl);

	return {
		gl,
		program,
		vao,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Handle WebGL context loss and retry rendering.
  2. Reduce concurrent WebGL effects to lower buffer allocation pressure.
  3. Update GPU drivers or use a software renderer.
  4. Verify headless Chrome GPU flags enable WebGL2 buffer operations.
Defensive patterns

Strategy: try-catch

Try / catch

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

Prevention

When it happens

Trigger: During setupMirror, after the VAO is created and bound, gl.createBuffer() returns null. The VBO holds the 16-float interleaved position+UV data for the fullscreen quad.

Common situations: Context loss during setup; GPU buffer memory exhaustion; headless environments with limited WebGL2 buffer allocation; driver bugs under load.

Related errors


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