{"record":{"id":"8fc3e08ada1c2a4d","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-8fc3e0","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/color-key.ts","lineNumber":213,"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(`Color key 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(`Color key 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":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/color-key.ts#L195-L231","documentation":"Thrown by linkProgram in the color key effect when gl.createProgram() returns null after both shaders compiled. The GL context cannot allocate a program object, signaling resource exhaustion or context loss. The color key effect cannot link a program, so setup fails.","triggerScenarios":"At color-key.ts:213 inside linkProgram after COLOR_KEY_VS and COLOR_KEY_FS compiled successfully, but gl.createProgram() yields null. Caused by GL object-limit exhaustion or a lost context; independent of colorKey() parameters.","commonSituations":"High render concurrency with many live programs, software GL with low object limits, GPU memory pressure, or context loss during a long render.","solutions":["Reduce render concurrency so fewer GL program objects are live.","Render with GPU acceleration instead of software GL.","Update drivers/Chrome and retry for transient context loss.","Reduce the number of WebGL effects active in one pass."],"exampleFix":"// before\nremotion render main --concurrency=8\n\n// after\nremotion render main --concurrency=1","handlingStrategy":"retry","validationCode":"function webgl2ProgramAvailable(): boolean {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    if (!gl) return false;\n    const p = gl.createProgram();\n    const ok = p !== null;\n    if (p) gl.deleteProgram(p);\n    return ok;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await renderMedia({...});\n} catch (err) {\n  if (/Failed to create WebGL program/i.test(String(err))) {\n    await renderMedia({...opts, concurrency: 1});\n  } else {\n    throw err;\n  }\n}","preventionTips":["Lower render concurrency to keep the live GL program count low.","Render on GPU-accelerated infrastructure rather than software GL.","Keep drivers and Chromium current.","Stack fewer WebGL effects per frame."],"tags":["webgl","gpu-resource-exhaustion","color-key","shader-program","rendering","environment"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}