remotion-dev/remotion · error · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

pattern() creates a vertex array object (VAO) to encapsulate the fullscreen-quad vertex/buffer state. gl.createVertexArray() returns null when the context is lost or the driver refuses allocation. This guard prevents bindVertexArray from receiving null.

Source

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

			premultipliedAlpha: true,
			alpha: true,
			preserveDrawingBuffer: true,
		});
		if (!gl) {
			throw createWebGL2ContextError('pattern effect');
		}

		gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

		const vs = compileShader(gl, gl.VERTEX_SHADER, PATTERN_VS);
		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');

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Maintain a live WebGL2 context (webglcontextlost/restored handling).
  2. Lower the count of concurrent GPU effects in the composition.
  3. Use SwiftShader / a real GPU in headless rendering.
  4. Update GPU drivers.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  initPattern(canvas); // creates VAO among other GL objects
} catch (err) {
  if (isContextLost(canvas)) waitForRestore(canvas).then(initPattern);
  else throw err;
}

Prevention

When it happens

Trigger: Reached inside pattern()'s state initializer after shaders are compiled and the program linked. gl.createVertexArray() returns null due to context loss or driver resource limits.

Common situations: Long renders with context eviction; heavy compositions saturating VAO/driver limits; headless rendering on an unstable GPU; backgrounded tabs losing context.

Related errors


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