{"record":{"id":"201deafb2969092d","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-201dea","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/shine.ts","lineNumber":215,"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(`Shine 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(`Shine program link failed: ${log ?? '(no log)'}`);\n\t}\n\n\treturn program;\n};\n\nexport const shine = createEffect<ShineParams, ShineState>({\n\ttype: 'dev.remotion.effects.shine',\n\tlabel: 'shine()',\n\tdocumentationLink: 'https://www.remotion.dev/docs/effects/shine',","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/shine.ts#L197-L233","documentation":"The shine() effect's linkProgram helper calls gl.createProgram() and throws this generic Error when the WebGL2 driver returns null. This means the context exists but cannot allocate a program object, which indicates severe GPU resource exhaustion or a context that entered a lost state after creation.","triggerScenarios":"Calling shine() when the WebGL2 context is under extreme resource pressure — too many live program objects, GPU memory exhaustion, or a context-loss event that occurred between getContext and createProgram.","commonSituations":"Headless renderers under high concurrency exhausting the driver's program object pool; software rendering backends with hard resource caps; a page with leaked program objects from prior effect instances that were not cleaned up.","solutions":["Reduce concurrency so fewer WebGL2 contexts and program objects are live simultaneously.","Ensure Remotion's cleanup lifecycle runs — each effect's cleanup() deletes its program; avoid patterns that bypass cleanup.","Verify GPU acceleration in the render environment.","Restart the render if a transient context loss caused the failure."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// Probe whether the WebGL2 context can allocate a program object\nfunction canCreateProgram(canvas: HTMLCanvasElement): boolean {\n  const gl = canvas.getContext('webgl2');\n  if (!gl) return false;\n  const program = gl.createProgram();\n  const ok = program !== null;\n  if (program) gl.deleteProgram(program);\n  return ok;\n}","typeGuard":"null","tryCatchPattern":"try {\n  shine({ progress: 0.5 });\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to create WebGL program') {\n    console.warn('WebGL2 program allocation failed');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Reduce concurrency to limit simultaneous program objects.","Ensure effect cleanup() runs to release GPU program objects.","Verify GPU acceleration in the render environment.","Handle context-loss events and retry after restoration."],"tags":["webgl2","gpu","resource-allocation","program","memory"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}