remotion-dev/remotion · error · Error

Failed to create WebGL buffer

Error message

Failed to create WebGL buffer

What it means

pattern() allocates a VBO for the fullscreen-quad vertices. gl.createBuffer() returns null when the context is lost or the driver refuses further allocations. This guard converts the silent null into an explicit setup failure before bindBuffer/bufferData.

Source

Thrown at packages/effects/src/pattern.ts:478

		const fs = compileShader(gl, gl.FRAGMENT_SHADER, PATTERN_FS);
		const program = linkProgram(gl, vs, fs);
		gl.deleteShader(vs);
		gl.deleteShader(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 texture = gl.createTexture();
		if (!texture) {
			throw new Error('Failed to create WebGL texture');
		}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Guarantee a live WebGL2 context via webglcontextlost/webglcontextrestored handling.
  2. Reduce simultaneous GPU effects to stay under driver object limits.
  3. Use a supported GPU or SwiftShader in headless rendering.
  4. Update GPU drivers.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  initPattern(canvas); // allocates the quad VBO
} catch (err) {
  if (isContextLost(canvas)) waitForRestore(canvas).then(initPattern);
  else throw err;
}

Prevention

When it happens

Trigger: Reached in pattern()'s initializer right after the VAO is created and bound. gl.createBuffer() returns null due to context loss or driver resource exhaustion.

Common situations: Context lost mid-setup; too many GL buffers alive across stacked effects; headless render under memory pressure; outdated GPU drivers.

Related errors


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