{"record":{"id":"cd37d9ffe8bfb314","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-cd37d9","errorCode":null,"errorMessage":"Failed to create WebGL program","messagePattern":"Failed to create WebGL program","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/waves.ts","lineNumber":388,"sourceCode":"\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(`Waves 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 => {\n\tconst program = gl.createProgram();\n\tif (!program) {\n\t\tthrow new Error('Failed to create WebGL program');\n\t}\n\n\tgl.attachShader(program, vs);\n\tgl.attachShader(program, fs);\n\tgl.linkProgram(program);\n\tif (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n\t\tconst log = gl.getProgramInfoLog(program);\n\t\tgl.deleteProgram(program);\n\t\tthrow new Error(`Waves program link failed: ${log ?? '(no log)'}`);\n\t}\n\n\treturn program;\n};\n\nconst createProgram = (\n\tgl: WebGL2RenderingContext,\n\tvertexSource: string,\n\tfragmentSource: string,","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/waves.ts#L370-L406","documentation":"Thrown by linkProgram() inside the waves effect when gl.createProgram() returns null. WebGL's createProgram returns null on context loss, context destruction, or resource exhaustion. The program object is needed to hold the linked vertex+fragment shader pair for the waves effect.","triggerScenarios":"Called transitively from setupWaves() at packages/effects/src/waves.ts:446 via createProgram → linkProgram. Fires when the GL context cannot allocate a program object. Since both shaders compiled successfully before this point, this indicates context loss or resource exhaustion occurring between shader compilation and program creation.","commonSituations":"WebGL context loss mid-setup; many concurrent effect instances exhausting program object slots; GPU process instability; constrained rendering environment.","solutions":["Handle 'webglcontextlost'/'webglcontextrestored' and recreate the effect on a new canvas.","Reduce concurrent effects and ensure cleanup of old states.","Update GPU drivers or switch render environments.","Recycle render worker processes in long-running server-side rendering."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"const gl = canvas.getContext('webgl2');\nif (!gl || gl.isContextLost()) {\n  return;\n}\ntry {\n  const state = setupWaves(canvas);\n} catch (e) {\n  if ((e as Error).message === 'Failed to create WebGL program') {\n    console.warn('Waves program allocation failed:', (e as Error).message);\n  }\n}","preventionTips":["Handle context loss/restoration events.","Clean up old waves effect states before creating new ones.","Recycle render worker processes in long-running sessions."],"tags":["webgl","gpu","program","resource-exhaustion","waves-effect"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}