{"record":{"id":"aa5cb52955187b6d","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-aa5cb5","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/duotone.ts","lineNumber":159,"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(`Duotone 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(`Duotone 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":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/duotone.ts#L141-L177","documentation":"Thrown by duotone's linkProgram() when gl.createProgram() returns null after both shaders compiled. The two shader objects were created fine, but the driver refused to allocate a program object, signalling context loss or resource exhaustion.","triggerScenarios":"Happens during setupDuotone() on a frame where the WebGL2 context has been lost or GPU program-object memory is exhausted between compileShader() and linkProgram().","commonSituations":"GPU process crash or driver reset mid-setup, running many concurrent GPU-effect renders, or a constrained/containerized GPU with limited program slots.","solutions":["Render with a software WebGL backend: `npx remotion render <comp> --gl=swiftshader`.","Reduce render concurrency so the per-frame WebGL context load stays within GPU limits.","Restart the GPU process (relaunch Chrome / the render worker) to clear a lost-context state.","Update the GPU driver / Chromium build."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function safeRender(opts) {\n  try {\n    return await renderMedia(opts);\n  } catch (err) {\n    if (/Failed to create WebGL program/.test(String(err?.message ?? ''))) {\n      return await renderMedia({...opts, gl: 'swiftshader'});\n    }\n    throw err;\n  }\n}","preventionTips":["Render with a software GL backend when GPU resources are constrained (`gl: 'swiftshader'`).","Limit concurrency to keep the per-frame context load within GPU limits.","Restart render workers periodically if you suspect context loss accumulation.","Update GPU drivers / Chromium."],"tags":["webgl","gpu","rendering","effects","runtime"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}