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 setupLines when gl.createVertexArray() returns null. The VAO holds the Lines quad's vertex/uv attribute bindings; without it the effect cannot draw, so setup aborts before uploading geometry.

Source

Thrown at packages/effects/src/lines.ts:390

};

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

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl, LINES_VS, 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 renders / browser contexts.
  2. Handle webglcontextlost and re-run the effect after 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 {
  lines(...);
} 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 exists but cannot allocate a VAO — resource exhaustion or context loss. This runs after the program is linked and before the vertex buffer is created, so it indicates general GL object allocation failure rather than anything param-specific.

Common situations: GPU/context resource exhaustion during heavy concurrent rendering; transient context-loss events; environments where VAO extension support is flaky.

Related errors


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