remotion-dev/remotion · critical · Error
Failed to create white balance shader program
Error message
Failed to create white balance shader program
What it means
Thrown by createProgram() in the white balance effect when gl.createProgram() returns null. WebGL's createProgram returns null on context loss, context destruction, or resource exhaustion. The program is needed to link the compiled vertex and fragment shaders into an executable.
Source
Thrown at packages/effects/src/white-balance.ts:149
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(
`White balance 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) {
throw new Error('Failed to create white balance shader program');
}
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(`White balance shader link failed: ${log ?? '(no log)'}`);
}
return program;
};
const createTexture = (gl: WebGL2RenderingContext): WebGLTexture => {View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Handle 'webglcontextlost'/'webglcontextrestored' and recreate the effect on a new canvas.
- Reduce concurrent effects and ensure cleanup of old states (cleanup deletes the program).
- Update GPU drivers or switch render backends.
- Recycle render worker processes in long-running server-side rendering.
Defensive patterns
Strategy: try-catch
Try / catch
const gl = canvas.getContext('webgl2');
if (!gl || gl.isContextLost()) {
return;
}
try {
const state = setupWhiteBalance(canvas);
} catch (e) {
if ((e as Error).message === 'Failed to create white balance shader program') {
console.warn('White balance program allocation failed:', (e as Error).message);
}
} Prevention
- Handle context loss/restoration events.
- Clean up old white balance effect states before creating new ones.
- Recycle render worker processes in long-running sessions.
When it happens
Trigger: Called from setupWhiteBalance() at packages/effects/src/white-balance.ts:194 via createProgram(gl) after both shaders compiled successfully. Fires when the GL context cannot allocate a program object — typically context loss or resource exhaustion after shader compilation already succeeded.
Common situations: Context loss mid-setup; many concurrent white balance effect instances exhausting program object slots; GPU process instability; constrained rendering environments (mobile, VM).
Related errors
- Failed to create WebGL program
- Failed to create WebGL program
- Failed to create WebGL program
- Failed to create white balance shader
- Failed to create WebGL program
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/e75e6a3e9dc3109a.
Report an issue: GitHub.