{"record":{"id":"f5479366e002fc97","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-f54793","errorCode":null,"errorMessage":"Failed to create WebGL program","messagePattern":"Failed to create WebGL program","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/contour-lines.ts","lineNumber":376,"sourceCode":"\tif (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n\t\tconst log = gl.getShaderInfoLog(shader);\n\t\tgl.deleteShader(shader);\n\t\tthrow new Error(\n\t\t\t`Contour lines shader compile failed: ${log ?? '(no log)'}`,\n\t\t);\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(`Contour lines 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":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/contour-lines.ts#L358-L394","documentation":"Thrown by linkProgram in contour-lines.ts when gl.createProgram() returns null. The WebGL2 context was acquired but could not allocate a program object. Like shader creation failure, this indicates GPU resource exhaustion or a lost context rather than a user input problem.","triggerScenarios":"During setupContourLines, after both vertex and fragment shaders compile successfully, gl.createProgram() returns null. This is reached only when the contour-lines effect initializes its WebGL pipeline.","commonSituations":"Too many WebGL programs allocated across effects in a single render; GPU memory pressure; context lost between shader compilation and program creation; running on a constrained software WebGL implementation in CI or a VM.","solutions":["Reduce the number of concurrently active WebGL effects.","Verify the GPU/context is healthy — check gl.isContextLost() before relying on the effect.","Use a rendering environment with adequate GPU resources (hardware-accelerated Chrome rather than a constrained headless setup).","Handle webglcontextlost to reinitialize effects after recovery."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify context is healthy before applying WebGL effects\nconst gl = target.getContext('webgl2');\nif (gl?.isContextLost()) {\n  // defer or skip the effect\n}","typeGuard":null,"tryCatchPattern":"try {\n  contourLines({...})(source, target);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to create WebGL program') {\n    // GPU resource exhaustion or context loss\n  }\n  throw e;\n}","preventionTips":["Reduce concurrent WebGL effects to lower program allocation.","Check gl.isContextLost() before relying on WebGL effects.","Use a GPU-capable rendering environment.","Handle webglcontextlost to reinitialize after recovery."],"tags":["webgl","effects","contour-lines","gpu","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}