remotion-dev/remotion · error · Error

Failed to create color correction texture

Error message

Failed to create color correction texture

What it means

Thrown by createTexture in the color correction effect when gl.createTexture() returns null. The GL context cannot allocate another texture object, indicating resource/memory exhaustion or context loss. The effect needs the source texture to receive frame pixels, so setup aborts.

Source

Thrown at packages/effects/src/color-correction.ts:355

	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(
			`Color correction shader link failed: ${log ?? '(no log)'}`,
		);
	}

	return program;
};

const createTexture = (gl: WebGL2RenderingContext): WebGLTexture => {
	const texture = gl.createTexture();
	if (!texture) {
		throw new Error('Failed to create color correction 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 setupColorCorrection = (
	target: HTMLCanvasElement,
): ColorCorrectionState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce render concurrency so fewer textures are live at once.
  2. Render with GPU acceleration rather than software GL.
  3. Update drivers/Chrome and retry for transient context loss.
  4. Fewer concurrent WebGL effects reduces aggregate texture allocation.

Example fix

// before
remotion render main --concurrency=8

// after
remotion render main --concurrency=1
Defensive patterns

Strategy: retry

Validate before calling

function webgl2TextureAvailable(): boolean {
  try {
    const c = document.createElement('canvas');
    const gl = c.getContext('webgl2');
    if (!gl) return false;
    const t = gl.createTexture();
    const ok = t !== null;
    if (t) gl.deleteTexture(t);
    return ok;
  } catch {
    return false;
  }
}

Try / catch

try {
  await renderMedia({...});
} catch (err) {
  if (/Failed to create color correction texture/i.test(String(err))) {
    await renderMedia({...opts, concurrency: 1});
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: At color-correction.ts:355 inside setupColorCorrection (textureSource = createTexture(gl)) after the program, VAO, and VBO are built. gl.createTexture() returns null under GL object/memory pressure or a lost context; not caused by colorCorrection() params.

Common situations: High render concurrency, software GL with low texture limits, GPU memory pressure, or a render that suffered context loss.

Related errors


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