{"record":{"id":"11d7e4b225bb5c0d","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-11d7e4","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/skew.ts","lineNumber":193,"sourceCode":"\treturn shader;\n};\n\nconst setupSkew = (target: HTMLCanvasElement): SkewState => {\n\tconst gl = target.getContext('webgl2', {\n\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) {\n\t\tthrow createWebGL2ContextError('skew effect');\n\t}\n\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\tconst vertexShader = compileShader(gl, gl.VERTEX_SHADER, SKEW_VS);\n\tconst fragmentShader = compileShader(gl, gl.FRAGMENT_SHADER, SKEW_FS);\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, vertexShader);\n\tgl.attachShader(program, fragmentShader);\n\tgl.linkProgram(program);\n\tgl.deleteShader(vertexShader);\n\tgl.deleteShader(fragmentShader);\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(`Skew program link failed: ${log ?? '(no log)'}`);\n\t}\n\n\tconst vao = gl.createVertexArray();\n\tconst vbo = gl.createBuffer();\n\tif (!vao || !vbo) {\n\t\tthrow new Error('Failed to create WebGL geometry');\n\t}","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/skew.ts#L175-L211","documentation":"The skew() effect acquired a WebGL2 context and compiled both shaders, but gl.createProgram() returned null in setupSkew(). A null program object means the context lost resources or hit a driver-imposed program limit, so the effect cannot link its vertex/fragment shaders and throws before continuing.","triggerScenarios":"Context loss or GPU resource exhaustion occurring between shader compilation and program creation inside setupSkew(); a driver that imposes a low ceiling on simultaneously-live program objects when many WebGL2 effects are initialized.","commonSituations":"Many stacked WebGL2 effects per composition combined with high render concurrency; long-running renders that gradually exhaust driver resources; headless/CI hosts without a real GPU; driver reset mid-setup.","solutions":["Use the ANGLE backend (--gl=angle / chromiumOptions.gl='angle' / Studio OpenGL=angle) for more reliable program allocation.","Reduce concurrency and the count of simultaneously-active WebGL2 effects to stay under driver resource limits.","Ensure effect cleanup (gl.deleteProgram etc.) runs so program handles are freed before new effects allocate them.","Render on a host with a supported GPU and up-to-date drivers."],"exampleFix":"// before\nawait renderMedia({ composition, serveUrl });\n\n// after\nawait renderMedia({ composition, serveUrl, chromiumOptions: { gl: 'angle' } });","handlingStrategy":"try-catch","validationCode":"// No caller-side check can predict a null gl.createProgram().\n// Best pre-flight is generic WebGL2 capability (see error 900).\nfunction webgl2Available(): boolean {\n  try {\n    return !!document.createElement('canvas').getContext('webgl2');\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await renderMedia({ composition, codec: 'h264', chromiumOptions: { gl: 'angle' } });\n} catch (err) {\n  if (err instanceof Error && /Failed to create WebGL program/.test(err.message)) {\n    console.error('skew() could not allocate a WebGL program (context lost/exhausted). Lower concurrency or switch GL backend.', err);\n    throw err;\n  }\n  throw err;\n}","preventionTips":["Render WebGL2 effects with ANGLE and conservative concurrency.","Free effect resources (cleanup) before allocating new ones.","Monitor for WebGL context-loss events in long-running renders.","Render on hosts with verified GPU/driver support."],"tags":["webgl","gpu","effects","skew","rendering","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}