remotion-dev/remotion · error · Error

Failed to create levels vertex buffer

Error message

Failed to create levels vertex buffer

What it means

Thrown by `setupLevels()` when `gl.createBuffer()` returns `null`. The vertex buffer (holding the fullscreen-quad UV/position data) could not be allocated, meaning the context is lost or GPU buffer memory/object slots are exhausted.

Source

Thrown at packages/effects/src/levels.ts:233

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

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl);
	const vao = gl.createVertexArray();
	if (!vao) {
		throw new Error('Failed to create levels vertex array');
	}

	const vbo = gl.createBuffer();
	if (!vbo) {
		throw new Error('Failed to create levels vertex buffer');
	}

	gl.bindVertexArray(vao);
	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);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce concurrency and dispose unused GL buffers.
  2. Handle context loss and recreate the effect.
  3. Restart the GPU/Chrome process to reclaim leaked buffer objects.
  4. Use a render environment with adequate video memory.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  levels({...})(...);
} catch (err) {
  if (/Failed to create levels vertex buffer/.test(String(err))) {
    console.warn('levels() VBO unavailable', err);
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Context loss before buffer creation; many concurrent buffer allocations; VRAM exhaustion.

Common situations: Highly concurrent or long-running renders leaking GL buffers; memory-constrained CI/Lambda; backgrounded tabs with lost contexts.

Related errors


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