{"record":{"id":"993863ee1b54545f","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array-993863","errorCode":null,"errorMessage":"Failed to create WebGL vertex array","messagePattern":"Failed to create WebGL vertex array","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/pattern.ts","lineNumber":467,"sourceCode":"\t\t\tpremultipliedAlpha: true,\n\t\t\talpha: true,\n\t\t\tpreserveDrawingBuffer: true,\n\t\t});\n\t\tif (!gl) {\n\t\t\tthrow createWebGL2ContextError('pattern effect');\n\t\t}\n\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\t\tconst vs = compileShader(gl, gl.VERTEX_SHADER, PATTERN_VS);\n\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');","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/pattern.ts#L449-L485","documentation":"pattern() creates a vertex array object (VAO) to encapsulate the fullscreen-quad vertex/buffer state. gl.createVertexArray() returns null when the context is lost or the driver refuses allocation. This guard prevents bindVertexArray from receiving null.","triggerScenarios":"Reached inside pattern()'s state initializer after shaders are compiled and the program linked. gl.createVertexArray() returns null due to context loss or driver resource limits.","commonSituations":"Long renders with context eviction; heavy compositions saturating VAO/driver limits; headless rendering on an unstable GPU; backgrounded tabs losing context.","solutions":["Maintain a live WebGL2 context (webglcontextlost/restored handling).","Lower the count of concurrent GPU effects in the composition.","Use SwiftShader / a real GPU in headless rendering.","Update GPU drivers."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  initPattern(canvas); // creates VAO among other GL objects\n} catch (err) {\n  if (isContextLost(canvas)) waitForRestore(canvas).then(initPattern);\n  else throw err;\n}","preventionTips":["Maintain a live WebGL2 context via webglcontextlost/restored handling.","Reduce concurrent GPU effects to stay within the driver's object budget.","Use SwiftShader or a real GPU in headless rendering.","Keep GPU drivers current."],"tags":["webgl","gpu","vao","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"}