remotion-dev/remotion · critical · Error
Failed to create WebGL shader
Error message
Failed to create WebGL shader
What it means
Thrown by burlap's `compileShader` when `gl.createShader(type)` returns `null`. This is a resource/context-loss failure (the GL implementation refused to allocate a shader object), distinct from a GLSL compile error which is thrown separately with the info log.
Source
Thrown at packages/effects/src/burlap.ts:239
vec3 rgb = texColor.rgb / alpha;
float darkFiber = clamp(-texture * 3.2 + gaps * 0.12 + (dashH + dashV) * 0.18, 0.0, 1.0);
vec3 shaded = mix(rgb, uColor.rgb, darkFiber * uColor.a);
vec3 textured = clamp(shaded * (1.0 + max(texture, 0.0) * 0.45), 0.0, 1.0);
rgb = mix(rgb, textured, uAmount);
fragColor = vec4(rgb * alpha, alpha);
}
`;
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(`Burlap shader compile failed: ${log ?? '(no log)'}`);
}
return shader;
};
const linkProgram = (
gl: WebGL2RenderingContext,
vs: WebGLShader,
fs: WebGLShader,
): WebGLProgram => {View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Check `gl.isContextLost()` before setup; reinitialize on restoration.
- Call burlap's `cleanup` to release the program/shaders of unused states.
- Limit concurrently active WebGL effects.
- Run on hardware-accelerated WebGL2; update GPU drivers.
Example fix
const gl = canvas.getContext('webgl2');
if (!gl || gl.isContextLost()) {
// do not setupBurlap; await context restoration
} else {
burlap.setup(canvas);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (gl.isContextLost()) { /* skip setupBurlap */ } Try / catch
try {
burlap.setup(canvas);
} catch (err) {
if (/Failed to create WebGL shader/.test(err.message)) {
// await restore or reduce effects, then retry
} else { throw err; }
} Prevention
- Free burlap states via burlap cleanup when unused.
- Handle webglcontextlost/restored.
- Limit concurrently active WebGL effects.
When it happens
Trigger: Fires at line 237-239 inside `setupBurlap` -> `compileShader` for either BURLAP_VS or BURLAP_FS, when `gl.createShader` returns null before source is attached.
Common situations: WebGL2 context lost during burlap setup; shader-object limit exhausted by many live effects; constrained software renderer in CI; GPU reset just before setup.
Related errors
- Failed to create WebGL shader
- Failed to create WebGL program
- Failed to create WebGL vertex array
- Failed to create WebGL shader
- Failed to create WebGL shader
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/6051a3c63ba25702.
Report an issue: GitHub.