{"record":{"id":"0ed1f930d9034f9d","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-0ed1f9","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/dot-grid.ts","lineNumber":179,"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(`Dot grid 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(`Dot grid program link failed: ${log ?? '(no log)'}`);\n\t}\n\n\treturn program;\n};\n\nexport const dotGrid = createEffect<DotGridParams, DotGridState>({\n\ttype: 'dev.remotion.effects.dotGrid',\n\tlabel: 'dotGrid()',\n\tdocumentationLink: 'https://www.remotion.dev/docs/effects/dot-grid',","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/dot-grid.ts#L161-L197","documentation":"Thrown by dot-grid's linkProgram helper when gl.createProgram() returns null. Like the shader case, a null program means the WebGL2 context cannot allocate another program object — typically context loss or per-context resource exhaustion. The bundled shaders have already been compiled successfully by the time this runs.","triggerScenarios":"The WebGL2 context is lost or has hit its implementation-defined program limit, or GPU memory is exhausted. Reached inside dotGrid().setup() after both shaders compiled, when gl.createProgram() is called.","commonSituations":"Many effects mounted simultaneously leaking programs (cleanup not called); long-running Studio sessions; GPU driver crash mid-session; headless rendering with a constrained software GL backend.","solutions":["Ensure every dotGrid() instance has its cleanup invoked (the framework does this when components unmount; verify you are not short-circuiting the effect lifecycle).","Reduce the number of simultaneously mounted WebGL2 effects in one composition.","Reload the page / restart Studio to release leaked programs.","For headless runs, use a software renderer and allocate adequate memory.","Update GPU drivers."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const supportsWebGL2 = () => {\n  try {\n    return !!document.createElement('canvas').getContext('webgl2');\n  } catch {\n    return false;\n  }\n};\n\nif (!supportsWebGL2()) {\n  // omit dotGrid() or render a fallback","typeGuard":null,"tryCatchPattern":"try {\n  state = dotGrid().setup(canvas);\n} catch (err) {\n  if (err instanceof Error && /WebGL program/i.test(err.message)) {\n    console.error('WebGL2 program allocation failed:', err.message);\n    // fall back or notify\n  } else {\n    throw err;\n  }\n}","preventionTips":["Ensure effect cleanup runs so programs are deleted between mounts.","Limit the number of WebGL2 effects per composition.","Reload to reclaim leaked resources; keep drivers current.","Use SwiftShader with adequate memory in headless environments."],"tags":["webgl2","dot-grid","program","gpu","runtime","resource-leak"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}