remotion-dev/remotion · critical · Error

Failed to create WebGL buffer

Error message

Failed to create WebGL buffer

What it means

A plain Error thrown inside setup in the Liquid contours effect when gl.createBuffer() returns null. The buffer holds the static full-screen quad data; allocation failure means geometry cannot be uploaded and the effect aborts.

Source

Thrown at packages/effects/src/liquid-contours.ts:334

		);
	}

	return program;
};

const setup = (target: HTMLCanvasElement): LiquidContoursState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) throw createWebGL2ContextError('liquid contours effect');
	const program = createProgram(gl);
	const vao = gl.createVertexArray();
	if (!vao) throw new Error('Failed to create WebGL vertex array');
	gl.bindVertexArray(vao);
	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,
		new Float32Array([-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1]),
		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});
	if (!colorCtx)

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Lower render concurrency.
  2. Ensure previous effects/contexts are disposed so buffers are reclaimed.
  3. Render on a host with adequate GPU memory / a stable GL backend.
Defensive patterns

Strategy: try-catch

Validate before calling

function canAllocateBuffer(): boolean {
  const c = document.createElement('canvas');
  const gl = c.getContext('webgl2');
  if (!gl) return false;
  return !!gl.createBuffer();
}

Try / catch

try {
  liquidContours(...);
} catch (err) {
  if (err instanceof Error && /WebGL buffer/.test(err.message)) {
    // free buffers / reduce concurrency, then retry
  } else throw err;
}

Prevention

When it happens

Trigger: WebGL2 context is alive but cannot allocate a buffer object — GPU memory exhaustion or context loss. Reached immediately after the VAO is created and bound, before bufferData with the quad Float32Array.

Common situations: Heavy concurrent rendering saturating GPU memory; leaked GL objects; headless software GL with a small buffer budget; a transient context-loss event.

Related errors


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