remotion-dev/remotion · error · Error

Failed to create WebGL texture

Error message

Failed to create WebGL texture

What it means

Thrown inside `lightLeak`'s setup when `gl.createTexture()` returns `null`. The effect's working texture cannot be allocated — context loss or GPU texture-memory/object-slot exhaustion.

Source

Thrown at packages/effects/src/light-leak.ts:284

		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');
		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);

		const texture = gl.createTexture();
		if (!texture) {
			throw new Error('Failed to create WebGL texture');
		}

		gl.bindTexture(gl.TEXTURE_2D, texture);
		gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
		gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
		gl.bindTexture(gl.TEXTURE_2D, null);

		return {
			gl,
			program,
			vao,
			vbo,
			texture,
			uSource: gl.getUniformLocation(program, 'uSource'),
			uEvolveProgress: gl.getUniformLocation(program, 'evolveProgress'),
			uRetractProgress: gl.getUniformLocation(program, 'retractProgress'),
			uSeed: gl.getUniformLocation(program, 'seed'),
			uRetractSeed: gl.getUniformLocation(program, 'retractSeed'),

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce per-frame texture pressure: fewer concurrent effects, lower concurrency.
  2. Dispose prior WebGL resources to prevent texture leaks.
  3. Handle context-loss events and recreate the effect on restore.
  4. Render on an instance with more GPU VRAM.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  lightLeak({...})(...);
} catch (err) {
  if (/Failed to create WebGL texture/.test(String(err))) {
    console.warn('lightLeak() texture unavailable', err);
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Context lost before texture creation; excessive simultaneous texture allocations; VRAM exhaustion on large frames.

Common situations: Many layered effects at high resolution; leaked textures across frames; constrained environments.

Related errors


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