{"record":{"id":"6d3555be0a39e770","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-6d3555","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/region-blur/region-blur-runtime.ts","lineNumber":88,"sourceCode":"\treadonly compositeUniforms: {\n\t\treadonly source: WebGLUniformLocation | null;\n\t\treadonly blurred: WebGLUniformLocation | null;\n\t\treadonly resolution: WebGLUniformLocation | null;\n\t\treadonly topLeft: WebGLUniformLocation | null;\n\t\treadonly bottomRight: WebGLUniformLocation | null;\n\t\treadonly feather: WebGLUniformLocation | null;\n\t\treadonly roundness: 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 createProgram = (\n\tgl: WebGL2RenderingContext,\n\tvertexSource: string,\n\tfragmentSource: string,\n): WebGLProgram => {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/region-blur/region-blur-runtime.ts#L70-L106","documentation":"The region-blur runtime's compileShader helper calls gl.createShader(). If the WebGL2 context returns null, there is no shader object to compile, and the effect throws immediately. A null return indicates a lost context, destroyed context, or exhausted shader object pool.","triggerScenarios":"Calling setupRegionBlur() after the WebGL2 context has been lost, after the context was externally destroyed, or when the GPU driver has exhausted its shader object allocation.","commonSituations":"GPU process crash; tab backgrounded on mobile with context loss; too many shader compilations without cleanup; headless rendering with an unstable software rasterizer.","solutions":["Handle 'webglcontextlost' and reinitialize after 'webglcontextrestored'","Dispose of old region-blur effects before creating new ones to free shader objects","Reduce the number of concurrent WebGL2 effects in the composition","Restart the render process if the GL context is irrecoverably corrupted"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"canvas.addEventListener('webglcontextlost', (e) => { e.preventDefault(); }, false);\ncanvas.addEventListener('webglcontextrestored', () => {\n  // re-initialize region-blur effect, re-compiling shaders\n}, false);","preventionTips":["Handle context loss/restoration events on every WebGL canvas","Dispose of region-blur effects before creating new ones","Limit concurrent WebGL2 effects to stay within shader object limits"],"tags":["webgl","gpu","shader","resource-exhaustion","context-lost","region-blur"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}