remotion-dev/remotion · error · Error
Failed to create WebGL shader
Error message
Failed to create WebGL shader
What it means
Thrown by compileShader() in the chromatic aberration runtime when gl.createShader(type) returns null. A null shader object means the WebGL2 context is lost/destroyed or its shader object budget is exhausted, so compilation cannot begin and effect setup aborts before linking.
Source
Thrown at packages/effects/src/chromatic-aberration/chromatic-aberration-runtime.ts:28
gl: WebGL2RenderingContext;
program: WebGLProgram;
vao: WebGLVertexArrayObject;
vbo: WebGLBuffer;
textureSource: WebGLTexture;
uniforms: {
uSource: WebGLUniformLocation | null;
uOffset: WebGLUniformLocation | null;
};
};
const compileShader = (
gl: WebGL2RenderingContext,
type: number,
source: string,
): WebGLShader => {
const shader = gl.createShader(type);
if (!shader) {
throw new Error('Failed to create WebGL 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(`Shader compile failed: ${log ?? '(no log)'}`);
}
return shader;
};
const linkProgram = (
gl: WebGL2RenderingContext,
vs: WebGLShader,
fs: WebGLShader,
): WebGLProgram => {View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Reduce concurrent WebGL-using effects/compositions.
- Enable real GPU acceleration in the render browser.
- Handle 'webglcontextlost'/'webglcontextrestored' and recreate the effect.
- Update GPU drivers; verify WebGL2 support.
- Use a GPU-enabled/higher-memory instance server-side.
Defensive patterns
Strategy: try-catch
Validate before calling
function probeWebGL2(): boolean {
try {
const c = document.createElement('canvas');
const gl = c.getContext('webgl2');
return !!gl && !gl.isContextLost();
} catch {
return false;
}
}
if (!probeWebGL2()) skipOrFallback(); Try / catch
try {
return <ChromaticAberration {...props} />;
} catch (err) {
if (/Failed to create WebGL shader/.test(String(err))) return <FallbackFrame />;
throw err;
} Prevention
- Limit concurrent WebGL effects to keep shader budgets healthy.
- Free GL resources on unmount via the cleanup path.
- Recreate the effect after 'webglcontextrestored'.
- Render with a GPU-accelerated Chromium.
When it happens
Trigger: setupChromaticAberration() -> createProgram() -> compileShader() calls gl.createShader() at chromatic-aberration-runtime.ts:26; it returns null and the guard at :27 throws.
Common situations: Many concurrent compositions, --disable-gpu / SwiftShader overload, blacklisted GPU, context loss during tab throttling, or a VM/lambda without GPU acceleration.
Related errors
- Shader compile failed: ${log ?? '(no log)'}
- Failed to create WebGL shader
- Checkerboard shader compile failed: ${log ?? '(no log)'}
- Failed to create WebGL program
- Program link failed: ${log ?? '(no log)'}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/b6a0cc13e9fb14e0.
Report an issue: GitHub.