{"record":{"id":"5ca368e0894f5b5a","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-5ca368","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/venetian-blinds.ts","lineNumber":191,"sourceCode":"void main() {\n\tvec4 source = texture(uSource, vUv);\n\tfloat axis = uDirection == 0 ? vUv.x : vUv.y;\n\tfloat local = fract(axis * max(uSlats, 1.0));\n\tfloat distanceToCenter = abs(local - 0.5) * 2.0;\n\tfloat mask = maskValue(distanceToCenter, uProgress);\n\n\tfragColor = vec4(source.rgb * mask, source.a * mask);\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(\n\t\t\t`Venetian blinds shader compile failed: ${log ?? '(no log)'}`,\n\t\t);\n\t}\n\n\treturn shader;\n};\n\nconst linkProgram = (\n\tgl: WebGL2RenderingContext,\n\tvs: WebGLShader,","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/venetian-blinds.ts#L173-L209","documentation":"Thrown by the venetian-blinds effect's compileShader helper when gl.createShader() returns null during setupVenetianBlinds. A null shader handle means the WebGL2 context is lost or the GPU has exhausted its object allocation budget. The library fails immediately rather than proceeding with a null shader.","triggerScenarios":"setupVenetianBlinds -> compileShader -> gl.createShader(gl.VERTEX_SHADER or gl.FRAGMENT_SHADER) returns null. Occurs under context loss (WEBGL_lose_context), GPU memory exhaustion, or when too many GL contexts are alive in the process.","commonSituations":"Headless rendering (Lambda/CI) with many parallel jobs; GPU driver crash or TDR mid-render; long-running Studio sessions that leak GL contexts; VMs with software rendering and low object limits.","solutions":["Reduce render concurrency to lower the number of simultaneous WebGL2 contexts","Ensure hardware GPU acceleration in the rendering browser (proper Chrome GPU flags)","Listen for webglcontextlost and restart the render job after webglcontextrestored","Update GPU drivers or move to an environment with a dedicated GPU"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const state = setupVenetianBlinds(canvas);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Failed to create WebGL shader') {\n    // GL context lost or GPU exhausted — restart the render process.\n    throw new Error('WebGL2 context unavailable for venetian-blinds. Retry render.');\n  }\n  throw err;\n}","preventionTips":["Monitor webglcontextlost events on the canvas to detect context loss proactively","Keep concurrent render process count within the GPU's context/object budget","Ensure the rendering browser has hardware GPU acceleration enabled"],"tags":["webgl","gpu","venetian-blinds","context-loss","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}