remotion-dev/remotion · error · Error

Failed to create vibrance shader

Error message

Failed to create vibrance shader

What it means

Thrown by the vibrance effect's compileShader helper when gl.createShader() returns null during createProgram -> compileShader. A null shader handle indicates the WebGL2 context is lost or GPU object allocation is exhausted. The library aborts immediately rather than proceeding with an invalid shader.

Source

Thrown at packages/effects/src/vibrance.ts:104

		fragColor = vec4(0.0);
		return;
	}

	vec3 color = sourceColor.rgb / alpha;
	vec3 adjusted = applyVibrance(color, uAmount);

	fragColor = vec4(adjusted * alpha, alpha);
}
`;

const compileShader = (
	gl: WebGL2RenderingContext,
	type: number,
	source: string,
): WebGLShader => {
	const shader = gl.createShader(type);
	if (!shader) {
		throw new Error('Failed to create vibrance shader');
	}

	gl.shaderSource(shader, source);
	gl.compileShader(shader);
	if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
		const log = gl.getShaderInfoLog(shader);
		gl.deleteShader(shader);
		throw new Error(`Vibrance shader compile failed: ${log ?? '(no log)'}`);
	}

	return shader;
};

const createProgram = (gl: WebGL2RenderingContext): WebGLProgram => {
	const vertexShader = compileShader(gl, gl.VERTEX_SHADER, VERTEX_SHADER);
	const fragmentShader = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);
	const program = gl.createProgram();
	if (!program) {

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce render concurrency to lower simultaneous WebGL2 context count
  2. Ensure hardware GPU acceleration in the rendering browser
  3. Handle webglcontextlost and retry the render after webglcontextrestored
  4. Update GPU drivers or switch to a GPU with adequate resources
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const state = setupVibrance(canvas);
} catch (err) {
  if (err instanceof Error && err.message === 'Failed to create vibrance shader') {
    throw new Error('WebGL2 context lost during vibrance shader creation. Retry render.');
  }
  throw err;
}

Prevention

When it happens

Trigger: setupVibrance -> createProgram -> compileShader -> gl.createShader(gl.VERTEX_SHADER or gl.FRAGMENT_SHADER) returns null. Occurs under context loss, GPU memory exhaustion, or too many live GL contexts.

Common situations: Headless rendering (Lambda/CI) with many parallel jobs exhausting GL contexts; GPU driver crash or TDR; long-running Studio sessions; VMs with software rendering.

Related errors


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