remotion-dev/remotion · error · Error

Failed to create WebGL buffer

Error message

Failed to create WebGL buffer

What it means

Thrown by setupDropShadow when gl.createBuffer() returns null. A null buffer signals a lost or exhausted WebGL2 context. Reached immediately after the VAO is bound, while allocating the shared fullscreen-quad vertex buffer.

Source

Thrown at packages/effects/src/drop-shadow/drop-shadow-runtime.ts:177

		gl,
		DROP_SHADOW_VS,
		DROP_SHADOW_COMPOSITE_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);
	const textureShadowA = createRgbaTexture(gl);
	const textureShadowB = createRgbaTexture(gl);

	const framebuffer = gl.createFramebuffer();
	if (!framebuffer) {

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Verify cleanupDropShadow runs (gl.deleteBuffer on unmount).
  2. Reduce simultaneous WebGL2 effects.
  3. Reload to release leaked resources.
  4. Use SwiftShader with adequate memory for headless runs.
  5. Update GPU drivers.
Defensive patterns

Strategy: try-catch

Validate before calling

const supportsWebGL2 = () => {
  try {
    return !!document.createElement('canvas').getContext('webgl2');
  } catch {
    return false;
  }
};

Try / catch

try {
  state = setupDropShadow(canvas);
} catch (err) {
  if (err instanceof Error && /WebGL buffer/i.test(err.message)) {
    console.error('Drop-shadow buffer allocation failed:', err.message);
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Lost WebGL2 context, exhausted buffer object limit, or GPU memory pressure during setupDropShadow().

Common situations: Buffer leaks from effects whose cleanup never ran; many simultaneous drop-shadow effects; GPU driver crash; headless rendering under memory pressure.

Related errors


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