remotion-dev/remotion · critical · Error

Failed to create WebGL buffer

Error message

Failed to create WebGL buffer

What it means

Thrown by `setupBlur` when `gl.createBuffer()` returns `null`. The VBO stores the 16-float fullscreen quad (position + UV) shared by the VAO. A null handle means the GL context could not allocate another buffer object.

Source

Thrown at packages/effects/src/blur/blur-runtime.ts:139

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const programHorizontal = createProgram(gl, BLUR_VS, BLUR_FS_HORIZONTAL);
	const programVertical = createProgram(gl, BLUR_VS, BLUR_FS_VERTICAL);

	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 textureIntermediate = createRgbaTexture(gl);

	const framebuffer = gl.createFramebuffer();
	if (!framebuffer) {
		throw new Error('Failed to create WebGL framebuffer');

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Check `gl.isContextLost()` and reinitialize on restoration.
  2. Call `cleanupBlur` on unused states to release VBOs.
  3. Reduce concurrent WebGL effects.
  4. Ensure hardware-accelerated WebGL2 and current drivers.

Example fix

if (gl.isContextLost()) {
  // reinitialize after webglcontextrestored
} else {
  const state = setupBlur(canvas);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (gl.isContextLost()) { /* skip setupBlur */ }

Try / catch

try {
  const state = setupBlur(canvas);
} catch (err) {
  if (/Failed to create WebGL buffer/.test(err.message)) {
    // await restore or reduce effects, then retry
  } else { throw err; }
}

Prevention

When it happens

Trigger: Fires at line 137-139, after the VAO is bound, when `gl.createBuffer()` returns null.

Common situations: Context loss mid-setup; buffer-object cap exhausted by many live effects; software renderer with a low buffer limit.

Related errors


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