{"record":{"id":"7d241dbafa48978b","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-7d241d","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/wave/wave-runtime.ts","lineNumber":29,"sourceCode":"\ttextureSource: WebGLTexture;\n\tuniforms: {\n\t\tuSource: WebGLUniformLocation | null;\n\t\tuResolution: WebGLUniformLocation | null;\n\t\tuAmplitude: WebGLUniformLocation | null;\n\t\tuWavelength: WebGLUniformLocation | null;\n\t\tuPhase: WebGLUniformLocation | null;\n\t\tuDirection: 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/wave/wave-runtime.ts#L11-L47","documentation":"Thrown by wave-runtime's compileShader when gl.createShader() returns null. A null shader object means WebGL refused the allocation on context loss or GL object-limit exhaustion. The wave warp cannot compile its internal shaders without it.","triggerScenarios":"wave setup calls createProgram, which calls compileShader for the internal VERTEX_SHADER/FRAGMENT_SHADER; gl.createShader(type) returns null because the context is lost or too many shader objects are live.","commonSituations":"Context loss under many concurrent wave/other WebGL effects; GPU/driver object caps; headless Chrome on a constrained runner.","solutions":["Reload to reset the WebGL2 context.","Reduce the number of WebGL effects applied at once.","Verify hardware-accelerated WebGL2 and update drivers.","Dispose offscreen effects so shader objects are freed."],"exampleFix":"// before\nconst effect = wave({amplitude: 60, wavelength: 240}); // compileShader may throw\n\n// after\nconst effect = (() => {\n  try { return wave({amplitude: 60, wavelength: 240}); } catch { return null; }\n})();","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let effect = null;\ntry {\n  effect = wave({amplitude: 60, wavelength: 240});\n} catch (err) {\n  console.warn('wave shader alloc failed, skipping effect', err);\n}","preventionTips":["Reduce concurrent WebGL effects to stay under driver shader-object limits.","Handle context loss/restore and rebuild effects afterwards.","Free offscreen effects so shader objects are released.","Use hardware-accelerated WebGL2."],"tags":["webgl2","shader","gpu-memory","context-loss","wave"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}