remotion-dev/remotion · error · Error

Failed to create WebGL texture

Error message

Failed to create WebGL texture

What it means

The outline() effect allocates two textures (source image and polygon mask) via gl.createTexture(); a null return means the WebGL2 context is lost or out of GPU resources. This happens in setupOutline()'s texture creation phase, after program/VAO/VBO setup already succeeded.

Solutions

  1. Retry the render with lower concurrency and/or a lower resolution scale to cut GPU memory use
  2. Restart the render to obtain a fresh context
  3. Reduce the number of outline()-decorated elements mounted at the same time
  4. Update Chrome/GPU drivers if the error is persistent on one machine
Defensive patterns

Strategy: retry

Try / catch

try {
  await renderMediaOnLambda(/* ... */);
} catch (err) {
  if (err instanceof Error && err.message === 'Failed to create WebGL texture') {
    await renderMediaOnLambda(/* ..., concurrency: 2 */); // GPU memory pressure: retry lighter
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Applying outline() when GPU memory is exhausted (many large-format frames with effects in parallel) or after a context-loss event that leaves createTexture returning null.

Common situations: High-resolution (4K+) renders at high concurrency; Lambda renders near the memory ceiling; multiple elements with outline() rendered simultaneously in one Chrome instance.

Related errors


AI-assisted analysis of remotion-dev/remotion@10db9de073 (2026-08-22). Data as JSON: /api/errors/b4080202edbd2333. Report an issue: GitHub.

Appendix: source

Thrown at packages/effects/src/outline.ts:269

	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(`Outline 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 updatePolygonMask = ({
	source,
	width,
	height,
	simplification,
	outlineWidth,
	state,

View on GitHub (pinned to 10db9de073)