{"record":{"id":"f126d4e53c68a289","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-f126d4","errorCode":null,"errorMessage":"Failed to create WebGL shader","messagePattern":"Failed to create WebGL shader","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/checkerboard.ts","lineNumber":279,"sourceCode":"\t\t);\n\t\treturn;\n\t}\n\n\tfragColor = vec4(\n\t\tpremultipliedChecker + texColor.rgb * (1.0 - checkerAlpha),\n\t\tcheckerAlpha + texColor.a * (1.0 - checkerAlpha)\n\t);\n}\n`;\n\nconst compileShader = (\n\tgl: WebGL2RenderingContext,\n\ttype: number,\n\tsource: string,\n): WebGLShader => {\n\tconst shader = gl.createShader(type);\n\tif (!shader) {\n\t\tthrow new Error('Failed to create WebGL shader');\n\t}\n\n\tgl.shaderSource(shader, source);\n\tgl.compileShader(shader);\n\tif (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n\t\tconst log = gl.getShaderInfoLog(shader);\n\t\tgl.deleteShader(shader);\n\t\tthrow new Error(`Checkerboard shader compile failed: ${log ?? '(no log)'}`);\n\t}\n\n\treturn shader;\n};\n\nconst linkProgram = (\n\tgl: WebGL2RenderingContext,\n\tvs: WebGLShader,\n\tfs: WebGLShader,\n): WebGLProgram => {","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/checkerboard.ts#L261-L297","documentation":"Thrown by compileShader() (used by the checkerboard effect) when gl.createShader(type) returns null. A null shader object means the WebGL2 context cannot allocate a new shader — the context is lost, the GPU process crashed, or the shader object budget is exhausted. Compilation cannot even be attempted, so program creation aborts.","triggerScenarios":"createProgram() -> compileShader() calls gl.createShader() at checkerboard.ts:277 during setupCheckerboard(); it returns null (lost/destroyed context or GPU resource exhaustion) and the guard at :278 throws.","commonSituations":"Same family as other GL object failures: many concurrent compositions, --disable-gpu / SwiftShader overload, blacklisted GPU, context loss during throttling, or a VM/lambda without GPU acceleration.","solutions":["Reduce concurrent WebGL-using effects/compositions.","Enable real GPU acceleration in the render browser.","Handle 'webglcontextlost'/'webglcontextrestored' on the canvas and recreate the effect.","Update GPU drivers; confirm WebGL2 support.","Use a GPU-enabled instance/memory tier for server-side rendering."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function probeWebGL2(): boolean {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    return !!gl && !gl.isContextLost();\n  } catch {\n    return false;\n  }\n}\nif (!probeWebGL2()) skipOrFallback();","typeGuard":null,"tryCatchPattern":"try {\n  return <Checkerboard {...props} />;\n} catch (err) {\n  if (/Failed to create WebGL shader/.test(String(err))) return <FallbackFrame />;\n  throw err;\n}","preventionTips":["Limit concurrent WebGL effects to keep the per-context shader budget healthy.","Free GL resources on unmount via the effect cleanup paths.","Recreate the effect after 'webglcontextrestored'.","Render with a GPU-accelerated Chromium."],"tags":["webgl","glsl","shader","gpu","effects","checkerboard","rendering"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}