{"record":{"id":"049d2ef054fab923","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-049d2e","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/lines.ts","lineNumber":328,"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(`Lines 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(`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":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/lines.ts#L310-L346","documentation":"A plain Error thrown by linkProgram in the Lines effect when gl.createProgram() returns null. Like createShader, the WebGL2 spec permits null under resource exhaustion or context loss; the Lines effect fails fast rather than proceeding with a null program.","triggerScenarios":"The WebGL2 context is alive but cannot allocate a program object — typically GPU memory exhaustion, too many live programs, or a recently lost context. Occurs after the vertex and fragment shaders have already compiled successfully.","commonSituations":"Running many concurrent Remotion browser contexts that each compile WebGL programs; long-running render sessions that leak programs; headless environments with constrained software GL.","solutions":["Lower concurrency in the render (fewer parallel browser pages / Chromium instances).","Restart the render if a one-off context-loss event corrupted GPU state.","Verify the host has adequate GPU memory / a stable software GL backend for headless runs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function canAllocateProgram(): boolean {\n  const c = document.createElement('canvas');\n  const gl = c.getContext('webgl2');\n  if (!gl) return false;\n  return !!gl.createProgram();\n}","typeGuard":null,"tryCatchPattern":"try {\n  lines(...);\n} catch (err) {\n  if (err instanceof Error && /WebGL program/.test(err.message)) {\n    // reduce concurrency, restart the page/context, then retry\n  } else throw err;\n}","preventionTips":["Limit concurrent browser contexts so programs remain allocatable.","Dispose of unused Remotion effects/contexts to free GL programs.","Use a render host with adequate GPU memory."],"tags":["webgl2","lines-effect","gpu","resource-exhaustion","headless"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}