{"record":{"id":"c5d209ac68d5f104","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program","errorCode":null,"errorMessage":"Failed to create WebGL program","messagePattern":"Failed to create WebGL program","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/brand/src/effects/metallic-swirl-effect.ts","lineNumber":485,"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`Metallic swirl 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(`Metallic swirl program link failed: ${log ?? '(no log)'}`);\n\t}\n\n\treturn program;\n};\n\nexport const metallicSwirl = createEffect<\n\tMetallicSwirlParams,\n\tMetallicSwirlState\n>({","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/brand/src/effects/metallic-swirl-effect.ts#L467-L503","documentation":"In `linkProgram`, `gl.createProgram()` returned `null`. Per the WebGL2 spec this happens on context loss or severe resource exhaustion. The vertex and fragment shaders compiled successfully beforehand, so this is an environment/resource failure, not a shader bug.","triggerScenarios":"WebGL2 context lost between shader compile and program creation; GPU memory/object limit reached after creating many effects; broken context on virtual GPUs or headless software renderers.","commonSituations":"Many metallic-swirl effects mounted at once; long sessions leaking programs; rendering on under-resourced or virtualized GPUs; driver instability.","solutions":["Reduce the number of live effects/contexts to free GPU object slots.","Verify the WebGL2 context is stable (listen for 'webglcontextlost').","Update GPU drivers / use a hardware-accelerated browser.","For batch rendering, ensure contexts are disposed between compositions."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const supportsWebGL2 = (): boolean => {\n  try {\n    const c = document.createElement('canvas');\n    return !!c.getContext('webgl2');\n  } catch {\n    return false;\n  }\n};","typeGuard":"const hasHealthyWebGL2 = (canvas: HTMLCanvasElement): boolean => {\n  const gl = canvas.getContext('webgl2');\n  return !!gl && !gl.isContextLost();\n};","tryCatchPattern":"try {\n  metallicSwirl({speed: 1})(...);\n} catch (err) {\n  if (err instanceof Error && /Failed to create WebGL program/.test(err.message)) {\n    // reduce effect count or fall back\n  } else {\n    throw err;\n  }\n}","preventionTips":["Limit simultaneous WebGL2 effects to avoid exhausting program object slots.","Dispose/unmount effects to free GL objects between compositions.","Listen for 'webglcontextlost' on the canvas and recover gracefully.","Use a hardware-accelerated browser with current GPU drivers."],"tags":["brand","metallic-swirl","webgl","gpu","environment"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}