{"record":{"id":"6051a3c63ba25702","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-6051a3","errorCode":null,"errorMessage":"Failed to create WebGL shader","messagePattern":"Failed to create WebGL shader","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/burlap.ts","lineNumber":239,"sourceCode":"\n\tvec3 rgb = texColor.rgb / alpha;\n\tfloat darkFiber = clamp(-texture * 3.2 + gaps * 0.12 + (dashH + dashV) * 0.18, 0.0, 1.0);\n\tvec3 shaded = mix(rgb, uColor.rgb, darkFiber * uColor.a);\n\tvec3 textured = clamp(shaded * (1.0 + max(texture, 0.0) * 0.45), 0.0, 1.0);\n\trgb = mix(rgb, textured, uAmount);\n\n\tfragColor = vec4(rgb * alpha, alpha);\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(`Burlap 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":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/burlap.ts#L221-L257","documentation":"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.","triggerScenarios":"Fires at line 237-239 inside `setupBurlap` -> `compileShader` for either BURLAP_VS or BURLAP_FS, when `gl.createShader` returns null before source is attached.","commonSituations":"WebGL2 context lost during burlap setup; shader-object limit exhausted by many live effects; constrained software renderer in CI; GPU reset just before setup.","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."],"exampleFix":"const gl = canvas.getContext('webgl2');\nif (!gl || gl.isContextLost()) {\n  // do not setupBurlap; await context restoration\n} else {\n  burlap.setup(canvas);\n}","handlingStrategy":"try-catch","validationCode":"if (gl.isContextLost()) { /* skip setupBurlap */ }","typeGuard":null,"tryCatchPattern":"try {\n  burlap.setup(canvas);\n} catch (err) {\n  if (/Failed to create WebGL shader/.test(err.message)) {\n    // await restore or reduce effects, then retry\n  } else { throw err; }\n}","preventionTips":["Free burlap states via burlap cleanup when unused.","Handle webglcontextlost/restored.","Limit concurrently active WebGL effects."],"tags":["webgl2","shader","burlap","gpu-memory","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}