{"record":{"id":"48a7ce94d494d6d2","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-48a7ce","errorCode":null,"errorMessage":"Failed to create WebGL buffer","messagePattern":"Failed to create WebGL buffer","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/pattern.ts","lineNumber":478,"sourceCode":"\t\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, PATTERN_FS);\n\t\tconst program = linkProgram(gl, vs, fs);\n\t\tgl.deleteShader(vs);\n\t\tgl.deleteShader(fs);\n\n\t\tconst vao = gl.createVertexArray();\n\t\tif (!vao) {\n\t\t\tthrow new Error('Failed to create WebGL vertex array');\n\t\t}\n\n\t\tgl.bindVertexArray(vao);\n\n\t\tconst data = new Float32Array([\n\t\t\t-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,\n\t\t]);\n\n\t\tconst vbo = gl.createBuffer();\n\t\tif (!vbo) {\n\t\t\tthrow new Error('Failed to create WebGL buffer');\n\t\t}\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo);\n\t\tgl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);\n\n\t\tconst aPos = gl.getAttribLocation(program, 'aPos');\n\t\tconst aUv = gl.getAttribLocation(program, 'aUv');\n\t\tgl.enableVertexAttribArray(aPos);\n\t\tgl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);\n\t\tgl.enableVertexAttribArray(aUv);\n\t\tgl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);\n\n\t\tgl.bindVertexArray(null);\n\n\t\tconst texture = gl.createTexture();\n\t\tif (!texture) {\n\t\t\tthrow new Error('Failed to create WebGL texture');\n\t\t}","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/pattern.ts#L460-L496","documentation":"pattern() allocates a VBO for the fullscreen-quad vertices. gl.createBuffer() returns null when the context is lost or the driver refuses further allocations. This guard converts the silent null into an explicit setup failure before bindBuffer/bufferData.","triggerScenarios":"Reached in pattern()'s initializer right after the VAO is created and bound. gl.createBuffer() returns null due to context loss or driver resource exhaustion.","commonSituations":"Context lost mid-setup; too many GL buffers alive across stacked effects; headless render under memory pressure; outdated GPU drivers.","solutions":["Guarantee a live WebGL2 context via webglcontextlost/webglcontextrestored handling.","Reduce simultaneous GPU effects to stay under driver object limits.","Use a supported GPU or SwiftShader in headless rendering.","Update GPU drivers."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  initPattern(canvas); // allocates the quad VBO\n} catch (err) {\n  if (isContextLost(canvas)) waitForRestore(canvas).then(initPattern);\n  else throw err;\n}","preventionTips":["Guarantee a live WebGL2 context by handling webglcontextlost/restored.","Limit concurrent GPU effects to avoid exhausting driver buffer limits.","Use a supported GPU or SwiftShader in headless rendering.","Update GPU drivers."],"tags":["webgl","gpu","buffer","pattern-effect","context-loss","rendering"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}