{"record":{"id":"73326850465309e3","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-733268","errorCode":null,"errorMessage":"Failed to create WebGL program","messagePattern":"Failed to create WebGL program","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/mirror/mirror-runtime.ts","lineNumber":50,"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(`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(`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":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/mirror/mirror-runtime.ts#L32-L68","documentation":"While linking the mirror effect's compiled shaders into a WebGL program, gl.createProgram() returned null. The WebGL2 context is available but cannot allocate a new program object, typically due to context loss or severe GPU resource exhaustion.","triggerScenarios":"During setupMirror, linkProgram calls gl.createProgram() which returns null. This occurs after shaders have already compiled successfully, indicating the context can compile shaders but cannot create program objects.","commonSituations":"Context loss mid-setup; GPU memory exhaustion from too many simultaneous WebGL programs; driver bugs under heavy load; headless environments with marginal WebGL2 support.","solutions":["Reduce the number of concurrent WebGL effects being set up.","Ensure a healthy WebGL2 context — check for context loss and retry after the context is restored.","Use a more capable GPU or updated drivers in the render environment.","For headless rendering, verify the Chrome/GPU configuration supports program allocation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  // apply mirror effect\n} catch (e) {\n  if (e instanceof Error && e.message.includes('WebGL program')) {\n    console.warn('WebGL program creation failed, falling back without mirror');\n    // fallback rendering path\n  } else {\n    throw e;\n  }\n}","preventionTips":["Reduce the number of concurrent WebGL effects to avoid program allocation limits.","Handle WebGL context loss and retry rendering.","Ensure adequate GPU resources in the render environment."],"tags":["webgl","gpu","environment","mirror-effect","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}