remotion-dev/remotion · error · Error

Failed to create WebGL buffer

Error message

Failed to create WebGL buffer

What it means

After binding the VAO, the speckle() setup calls gl.createBuffer() for the quad vertex data; if it returns null the effect throws 'Failed to create WebGL buffer'. A null VBO means the context is lost or out of buffer resources, so there is nowhere to upload the Float32Array geometry and setup aborts.

Source

Thrown at packages/effects/src/speckle.ts:242

		const fs = compileShader(gl, gl.FRAGMENT_SHADER, SPECKLE_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');
		gl.enableVertexAttribArray(aPos);
		gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);
		gl.enableVertexAttribArray(aUv);
		gl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);

		gl.bindVertexArray(null);

		const texture = gl.createTexture();
		if (!texture) {
			throw new Error('Failed to create WebGL texture');
		}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Force ANGLE (--gl=angle / chromiumOptions.gl='angle' / Studio OpenGL=angle).
  2. Lower render concurrency and reduce simultaneous WebGL2 effects.
  3. Ensure gl.deleteBuffer runs on cleanup so buffers are recycled.
  4. Render on a machine with adequate GPU resources and supported drivers.

Example fix

// before
await renderMedia({ composition, serveUrl, chromiumOptions: {} });
// after
await renderMedia({ composition, serveUrl, chromiumOptions: { gl: 'angle' } });
Defensive patterns

Strategy: try-catch

Validate before calling

function webgl2Available(): boolean {
  try {
    return !!document.createElement('canvas').getContext('webgl2');
  } catch {
    return false;
  }
}

Try / catch

try {
  await renderMedia({ composition, codec: 'h264', chromiumOptions: { gl: 'angle' } });
} catch (err) {
  if (err instanceof Error && /Failed to create WebGL buffer/.test(err.message)) {
    console.error('speckle() VBO allocation failed (context lost/exhausted). Lower concurrency or switch GL backend.', err);
    throw err;
  }
  throw err;
}

Prevention

When it happens

Trigger: Context loss or buffer-object exhaustion during the speckle setup; hitting a driver-imposed buffer-object limit with many live WebGL2 effects allocating geometry simultaneously.

Common situations: Many parallel renders each using multiple WebGL2 effects; long-running renders leaking VBOs; software-GPU environments with low buffer caps; driver crash/reset between VAO and buffer creation.

Related errors


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