{"record":{"id":"51eaf15497a0fb4f","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-51eaf1","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/blur/blur-runtime.ts","lineNumber":38,"sourceCode":"\t\tuRadius: WebGLUniformLocation | null;\n\t\tuTexelSize: WebGLUniformLocation | null;\n\t\tuSource: WebGLUniformLocation | null;\n\t};\n\tvertical: {\n\t\tuRadius: WebGLUniformLocation | null;\n\t\tuTexelSize: WebGLUniformLocation | null;\n\t\tuSource: WebGLUniformLocation | null;\n\t};\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(`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":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/blur/blur-runtime.ts#L20-L56","documentation":"Thrown by the blur effect's `compileShader` helper when `gl.createShader(type)` returns `null`. This means the GL implementation refused to allocate a new shader object — an environmental failure (context loss, resource limit), not a problem with the GLSL source (that is reported separately by the compile-status check).","triggerScenarios":"Called from `createProgram(gl, BLUR_VS, BLUR_FS_*)` -> `compileShader` (line 36-38). Fires when `gl.createShader(gl.VERTEX_SHADER)` or `gl.createShader(gl.FRAGMENT_SHADER)` returns null, before any source is attached.","commonSituations":"WebGL2 context lost during blur setup; too many live shader objects across effects; a constrained software renderer in CI; a GPU driver crash/reset just before setup.","solutions":["Check `gl.isContextLost()` before calling setup; reinitialize on restore.","Call `cleanupBlur` on blur states no longer in use to free shaders/programs.","Limit concurrently active blur/other-WebGL effects.","Run on hardware-accelerated WebGL2; update GPU drivers if shader allocation persistently fails."],"exampleFix":"const gl = canvas.getContext('webgl2');\nif (!gl || gl.isContextLost()) {\n  // do not setupBlur; await context restoration\n} else {\n  const state = setupBlur(canvas);\n}","handlingStrategy":"try-catch","validationCode":"if (gl.isContextLost()) { /* skip setupBlur */ }","typeGuard":null,"tryCatchPattern":"try {\n  const state = setupBlur(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":["Call cleanupBlur on unused states.","Handle webglcontextlost/restored lifecycle.","Limit concurrently active blur effects."],"tags":["webgl2","shader","blur","gpu-memory","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}