remotion-dev/remotion · critical · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

Thrown by setupWaves() when gl.createVertexArray() returns null. A VAO is needed to encapsulate the vertex attribute bindings (aPos, aUv) for the fullscreen quad. createVertexArray returns null on context loss, context destruction, or resource exhaustion.

Source

Thrown at packages/effects/src/waves.ts:450

};

const setupWaves = (target: HTMLCanvasElement): WavesState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) {
		throw createWebGL2ContextError('waves effect');
	}

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl, WAVES_VS, WAVES_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');

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Handle 'webglcontextlost'/'webglcontextrestored' events and re-run setupWaves on a fresh canvas.
  2. Reduce concurrent effect instances and ensure cleanup runs.
  3. Update GPU drivers or switch render backends.
  4. Recycle worker processes in server-side rendering.
Defensive patterns

Strategy: try-catch

Try / catch

const gl = canvas.getContext('webgl2');
if (!gl || gl.isContextLost()) {
  return;
}
try {
  const state = setupWaves(canvas);
} catch (e) {
  if ((e as Error).message === 'Failed to create WebGL vertex array') {
    console.warn('Waves VAO allocation failed:', (e as Error).message);
  }
}

Prevention

When it happens

Trigger: Called from setupWaves() at packages/effects/src/waves.ts:448 after the program is created. Fires when the GL context cannot allocate a VAO. Since the program and shaders were already created, this indicates progressive resource exhaustion or a context-loss event between program creation and VAO creation.

Common situations: Context loss mid-setup; many concurrent effect canvases exhausting VAO slots; GPU instability in long render sessions; constrained environments (mobile GPU, VM).

Related errors


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