remotion-dev/remotion · critical · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

A plain Error thrown inside setup in the Liquid contours effect when gl.createVertexArray() returns null. The VAO holds the quad's attribute bindings; without it the effect cannot draw, so setup aborts right after createProgram and before buffer allocation.

Source

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

		gl.deleteProgram(program);
		throw new Error(
			`Liquid contours program link failed: ${log ?? '(no log)'}`,
		);
	}

	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;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce concurrent renders / browser contexts.
  2. Handle webglcontextlost and re-run the effect on webglcontextrestored.
  3. Use a render host with a robust WebGL2 implementation.
Defensive patterns

Strategy: try-catch

Validate before calling

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

Try / catch

try {
  liquidContours(...);
} catch (err) {
  if (err instanceof Error && /WebGL vertex array/.test(err.message)) {
    // restart context / lower concurrency, then retry
  } else throw err;
}

Prevention

When it happens

Trigger: WebGL2 context is alive but cannot allocate a VAO — resource exhaustion or context loss. Not param-dependent; runs on every Liquid contours effect setup after the program is linked.

Common situations: Concurrent render saturation of GPU objects; a leaked context; flaky VAO support in software GL; a context-loss race.

Related errors


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