remotion-dev/remotion · error · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

Thrown in setupContourLines when gl.createVertexArray() returns null. The WebGL2 context was acquired but could not allocate a VAO (vertex array object). This is a GPU resource exhaustion or context-loss issue.

Source

Thrown at packages/effects/src/contour-lines.ts:435

};

const setupContourLines = (target: HTMLCanvasElement): ContourLinesState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) {
		throw createWebGL2ContextError('contour lines effect');
	}

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl, CONTOUR_LINES_VS, CONTOUR_LINES_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. Reduce concurrent WebGL effects to lower VAO allocation pressure.
  2. Verify the context is not lost via gl.isContextLost().
  3. Use a GPU-capable rendering environment.
  4. Handle webglcontextlost for recovery.
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify WebGL2 context health before effect setup
const gl = target.getContext('webgl2');
if (gl?.isContextLost()) {
  // defer or skip
}

Try / catch

try {
  contourLines({...})(source, target);
} catch (e) {
  if (e instanceof Error && e.message === 'Failed to create WebGL vertex array') {
    // GPU resource issue — reduce concurrent effects
  }
  throw e;
}

Prevention

When it happens

Trigger: During contour-lines effect initialization, after the shader program is created, gl.createVertexArray() returns null.

Common situations: Too many VAOs allocated across effects; context lost; GPU memory pressure; constrained software WebGL implementation.

Related errors


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