remotion-dev/remotion · critical · Error

Failed to create WebGL texture

Error message

Failed to create WebGL texture

What it means

Thrown by createRgbaTexture in the glow runtime when gl.createTexture() returns null. The glow effect allocates three RGBA textures (source, glow buffer A, glow buffer B) for multi-pass Gaussian blur; null indicates GPU resource exhaustion or context loss.

Source

Thrown at packages/effects/src/glow/glow-runtime.ts:109

};

const createProgram = (
	gl: WebGL2RenderingContext,
	vertexSource: string,
	fragmentSource: string,
): WebGLProgram => {
	const vs = compileShader(gl, gl.VERTEX_SHADER, vertexSource);
	const fs = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);
	const program = linkProgram(gl, vs, fs);
	gl.deleteShader(vs);
	gl.deleteShader(fs);
	return program;
};

const createRgbaTexture = (gl: WebGL2RenderingContext): WebGLTexture => {
	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_MIN_FILTER, gl.LINEAR);
	gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
	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 texture;
};

const getBlurUniforms = (
	gl: WebGL2RenderingContext,
	program: WebGLProgram,
): GlowState['horizontal'] => ({
	uRadius: gl.getUniformLocation(program, 'uRadius'),
	uTexelSize: gl.getUniformLocation(program, 'uTexelSize'),
	uSource: gl.getUniformLocation(program, 'uSource'),

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce output resolution.
  2. Reduce the number of simultaneous glow effects.
  3. Retry on a host with more GPU memory.
Defensive patterns

Strategy: retry

Try / catch

let effect;
for (let attempt = 0; attempt < 3; attempt++) {
  try {
    effect = glow(params);
    break;
  } catch (err) {
    if (attempt === 2 || !/WebGL|texture/i.test(String(err))) throw err;
    await new Promise((r) => setTimeout(r, 200 * (attempt + 1)));
  }
}

Prevention

When it happens

Trigger: Context lost during glow setup; VRAM exhausted by large frame textures (the buffers are frame-resolution); stacking many glow effects.

Common situations: High-resolution render (4K) with multiple glow layers; headless Chrome near its VRAM ceiling.

Related errors


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