remotion-dev/remotion · critical · Error

Failed to create WebGL texture

Error message

Failed to create WebGL texture

What it means

The region-blur runtime allocates an RGBA texture via gl.createTexture(). If the WebGL2 context returns null, the effect cannot create its source/intermediate/output render surfaces and throws. This indicates context loss or VRAM exhaustion.

Source

Thrown at packages/effects/src/region-blur/region-blur-runtime.ts:131

	gl.attachShader(program, vertexShader);
	gl.attachShader(program, fragmentShader);
	gl.linkProgram(program);
	gl.deleteShader(vertexShader);
	gl.deleteShader(fragmentShader);
	if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
		const log = gl.getProgramInfoLog(program);
		gl.deleteProgram(program);
		throw new Error(`Program link failed: ${log ?? '(no log)'}`);
	}

	return program;
};

const createTexture = (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,
): BlurUniforms => ({
	source: gl.getUniformLocation(program, 'uSource'),
	radius: gl.getUniformLocation(program, 'uRadius'),
	texelSize: gl.getUniformLocation(program, 'uTexelSize'),

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Dispose of unused effects and their textures before creating new ones
  2. Reduce composition resolution or concurrent effect count
  3. Handle context loss/restoration and reinitialize textures
  4. Render on a GPU with more VRAM
Defensive patterns

Strategy: retry

Try / catch

canvas.addEventListener('webglcontextlost', (e) => { e.preventDefault(); }, false);
canvas.addEventListener('webglcontextrestored', () => {
  // re-initialize region-blur effect, re-creating textures
}, false);

Prevention

When it happens

Trigger: Calling setupRegionBlur() when the context is lost, when VRAM is fully consumed by existing textures, or when the texture object pool is depleted.

Common situations: High-resolution compositions consuming all VRAM; many effects with large intermediate textures; long sessions with texture leaks; mobile/integrated GPUs with limited memory.

Related errors


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