remotion-dev/remotion · critical · Error

Failed to create WebGL geometry

Error message

Failed to create WebGL geometry

What it means

Thrown by setupFlannel when gl.createVertexArray() or gl.createBuffer() returns null. Both return null only on context loss or severe resource exhaustion, indicating a GPU resource allocation failure for the fullscreen-quad geometry.

Source

Thrown at packages/effects/src/flannel.ts:240

	if (!program) {
		throw new Error('Failed to create WebGL program');
	}

	gl.attachShader(program, vertexShader);
	gl.attachShader(program, fragmentShader);
	gl.linkProgram(program);
	gl.deleteShader(vertexShader);
	gl.deleteShader(fragmentShader);
	if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
		const log = gl.getProgramInfoLog(program);
		gl.deleteProgram(program);
		throw new Error(`Flannel program link failed: ${log ?? '(no log)'}`);
	}

	const vao = gl.createVertexArray();
	const vbo = gl.createBuffer();
	if (!vao || !vbo) {
		throw new Error('Failed to create WebGL geometry');
	}

	gl.bindVertexArray(vao);
	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 texture = gl.createTexture();

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce the number of active WebGL effects.
  2. Retry on a new Chrome instance.
  3. Use a host with more GPU resources.
Defensive patterns

Strategy: retry

Try / catch

let effect;
for (let attempt = 0; attempt < 3; attempt++) {
  try {
    effect = flannel(params);
    break;
  } catch (err) {
    if (attempt === 2 || !/WebGL|geometry/i.test(String(err))) throw err;
    await new Promise((r) => setTimeout(r, 200 * (attempt + 1)));
  }
}

Prevention

When it happens

Trigger: Lost WebGL context before geometry allocation; many concurrent effects exhausting buffer/VAO object pools; software GL with strict object limits.

Common situations: Large compositions with dozens of WebGL layers; headless render under memory pressure; resumed after a GPU crash.

Related errors


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