remotion-dev/remotion · error · Error

Failed to create WebGL buffer

Error message

Failed to create WebGL buffer

What it means

Thrown by setupCheckerboard() when gl.createBuffer() returns null while allocating the fullscreen-quad vertex buffer. The buffer carries the position/UV data the checkerboard shader draws; without it the VAO cannot feed attributes, so setup aborts. Null indicates a lost context or exhausted GL buffer budget.

Source

Thrown at packages/effects/src/checkerboard.ts:373

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl, CHECKERBOARD_VS, CHECKERBOARD_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 colorCanvas = document.createElement('canvas');
	colorCanvas.width = 1;
	colorCanvas.height = 1;
	const colorCtx = colorCanvas.getContext('2d', {willReadFrequently: true});

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce simultaneous checkerboard/WebGL effects.
  2. Enable GPU acceleration; remove --disable-gpu.
  3. Handle 'webglcontextlost'/'webglcontextrestored' and rebuild the effect.
  4. Update GPU drivers and confirm WebGL2 buffer support.
  5. Use a GPU/higher-memory tier for server-side rendering.
Defensive patterns

Strategy: try-catch

Validate before calling

function probeWebGL2(): boolean {
  try {
    const c = document.createElement('canvas');
    const gl = c.getContext('webgl2');
    if (!gl) return false;
  const b = gl.createBuffer();
  const ok = !!b;
  if (b) gl.deleteBuffer(b);
  return ok && !gl.isContextLost();
  } catch {
  return false;
  }
}
if (!probeWebGL2()) skipOrFallback();

Try / catch

try {
  return <Checkerboard {...props} />;
} catch (err) {
  if (/Failed to create WebGL buffer/.test(String(err))) return <FallbackFrame />;
  throw err;
}

Prevention

When it happens

Trigger: setupCheckerboard() calls gl.createBuffer() at checkerboard.ts:371 inside the bound VAO; it returns null and the guard at :372 throws.

Common situations: Many concurrent compositions exhausting GL object budgets, software raster overload, --disable-gpu, GPU blacklisted, or a context-loss event after VAO creation.

Related errors


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