remotion-dev/remotion · critical · Error

Failed to create WebGL buffer

Error message

Failed to create WebGL buffer

What it means

Thrown by setupWave() when gl.createBuffer() returns null. A WebGL buffer object creation returns null on context loss, context destruction, or GPU resource exhaustion. The buffer is needed to hold the fullscreen-quad vertex data (position + UV) for the wave effect's draw call.

Source

Thrown at packages/effects/src/wave/wave-runtime.ts:133

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
	gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);

	const program = createProgram(gl, WAVE_VS, WAVE_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);

	return {
		gl,
		program,
		vao,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Handle 'webglcontextlost' / 'webglcontextrestored' events to recreate the effect state.
  2. Reduce the number of concurrent effect canvases and ensure cleanupWave() is called on discarded effects.
  3. Update GPU drivers and test on a different GPU/renderer (e.g., SwiftShader vs hardware) to isolate driver bugs.
  4. For headless/server rendering, recycle the worker process between heavy jobs to free GPU resources.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const state = setupWave(canvas);
} catch (e) {
  if ((e as Error).message === 'Failed to create WebGL buffer') {
    console.warn('Buffer allocation failed — possible context loss:', (e as Error).message);
  }
}

Prevention

When it happens

Trigger: Called from setupWave() at packages/effects/src/wave/wave-runtime.ts:131 after the VAO is created and bound. Fires when the GL context cannot allocate a buffer object — almost always context loss or resource exhaustion, since program and VAO creation already succeeded moments before.

Common situations: GPU resource exhaustion from many simultaneous WebGL contexts in a long render; context loss during setup; running on a GPU with very limited buffer object slots; the browser's GPU process crashed mid-setup.

Related errors


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