remotion-dev/remotion · critical · Error

Failed to create WebGL framebuffer

Error message

Failed to create WebGL framebuffer

What it means

Thrown by `setupBlur` when `gl.createFramebuffer()` returns `null`. The framebuffer is the render target for the horizontal blur pass (blur renders source -> intermediate texture via FBO, then intermediate -> canvas). A null handle is a resource-allocation/context-loss failure.

Source

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

		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');
	}

	const w = Math.max(1, target.width);
	const h = Math.max(1, target.height);
	gl.bindTexture(gl.TEXTURE_2D, textureIntermediate);
	gl.texImage2D(
		gl.TEXTURE_2D,
		0,
		gl.RGBA,
		w,
		h,
		0,
		gl.RGBA,
		gl.UNSIGNED_BYTE,
		null,
	);
	gl.bindTexture(gl.TEXTURE_2D, null);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Guard with `gl.isContextLost()`; reinitialize on restoration.
  2. Free unused blur states via `cleanupBlur` (deletes the framebuffer).
  3. Reduce concurrent blur effects.
  4. Confirm hardware-accelerated WebGL2; update drivers.

Example fix

if (gl.isContextLost()) {
  // reinitialize after restore
} 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 framebuffer/.test(err.message)) {
    // await restore or reduce effects, then retry
  } else { throw err; }
}

Prevention

When it happens

Trigger: Fires at line 155-157, after both textures are created, when `gl.createFramebuffer()` returns null.

Common situations: Context loss during setup; framebuffer-object cap reached by many live blur effects; software renderer with low FBO limits; the GL implementation does not expose the framebuffer capability.

Related errors


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