{"record":{"id":"955e03a8f9385691","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-955e03","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/corner-pin/corner-pin-runtime.ts","lineNumber":29,"sourceCode":"\tvbo: WebGLBuffer;\n\ttextureSource: WebGLTexture;\n\tuniforms: {\n\t\tuSource: WebGLUniformLocation | null;\n\t\tuTopLeft: WebGLUniformLocation | null;\n\t\tuTopRight: WebGLUniformLocation | null;\n\t\tuBottomRight: WebGLUniformLocation | null;\n\t\tuBottomLeft: 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":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/corner-pin/corner-pin-runtime.ts#L11-L47","documentation":"Thrown by compileShader in corner-pin-runtime.ts when gl.createShader(type) returns null. The WebGL2 context was acquired (context creation has its own error) but the GPU could not allocate a shader object. This is a resource-exhaustion or context-loss issue internal to the corner-pin effect's WebGL setup.","triggerScenarios":"setupCornerPin runs, the WebGL2 context is obtained from the target canvas, but gl.createShader(gl.VERTEX_SHADER) or gl.createShader(gl.FRAGMENT_SHADER) returns null during createProgram.","commonSituations":"GPU resource exhaustion from many simultaneous WebGL effects; WebGL context lost event; rendering in a constrained headless/CI/VM environment with limited GPU resources; browser tab backgrounded reclaiming GPU objects.","solutions":["Reduce the number of simultaneously active WebGL-backend effects.","Ensure headless Chrome (for Remotion CLI/Lambda) has GPU acceleration or full SwiftShader.","Check gl.isContextLost() and handle webglcontextlost.","Use a rendering environment with adequate GPU resources."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Check context health before applying corner pin\nconst gl = target.getContext('webgl2');\nif (!gl || gl.isContextLost()) {\n  // skip or fall back\n}","typeGuard":null,"tryCatchPattern":"try {\n  cornerPin({...})(source, target);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to create WebGL shader') {\n    // GPU resource issue — reduce active WebGL effects or use a better environment\n  }\n  throw e;\n}","preventionTips":["Limit simultaneously active WebGL-backend effects.","Ensure headless Chrome has GPU acceleration or SwiftShader.","Monitor gl.isContextLost() and webglcontextlost events.","Use a GPU-capable CI/rendering environment."],"tags":["webgl","effects","corner-pin","gpu","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}