{"record":{"id":"88bec71055baa613","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-88bec7","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/light-trail/light-trail-runtime.ts","lineNumber":57,"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(`Light trail 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(`Light trail 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":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/light-trail/light-trail-runtime.ts#L39-L75","documentation":"Thrown from lightTrail setup when `gl.createProgram()` returns `null`. Like other GL object allocations, this only fails under context loss, OUT_OF_MEMORY, or handle exhaustion — both attached shaders compiled successfully by this point.","triggerScenarios":"Calling setup after the GL context entered a lost state; allocating many programs in the same session until handles are exhausted; an OOM spike right after shader compilation succeeded.","commonSituations":"Many effects initialized in one render worker session without tearing down; headless Chromium with flaky GPU; a prior uncaught GL error leaving the context unusable.","solutions":["Reuse the cached setup keyed by params instead of calling setup per frame.","Listen for `webglcontextlost` and recreate state on restore.","Tear down (`cleanupLightTrail`) unused effect states before allocating new ones.","Ensure render workers have sufficient GPU memory; reduce concurrent compositions per worker."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const contextHealthy = (gl: WebGL2RenderingContext | null): boolean =>\n  !!gl && !gl.isContextLost();","typeGuard":"const isHealthyContext = (gl: WebGL2RenderingContext | null): gl is WebGL2RenderingContext =>\n  !!gl && !gl.isContextLost();","tryCatchPattern":"canvas.addEventListener('webglcontextlost', (e) => e.preventDefault());\ntry {\n  state = setupLightTrail(canvas);\n} catch (err) {\n  state = null; // fall back to non-effect render\n}","preventionTips":["Pair every setup with cleanup so program handles free up.","Reuse the cached setup; do not allocate programs per frame.","Recover gracefully on context loss/restore."],"tags":["webgl","light-trail","effects","gpu","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}