{"record":{"id":"8db9e495845cefcc","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array-8db9e4","errorCode":null,"errorMessage":"Failed to create WebGL vertex array","messagePattern":"Failed to create WebGL vertex array","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/lines.ts","lineNumber":390,"sourceCode":"};\n\nconst setupLines = (target: HTMLCanvasElement): LinesState => {\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('lines effect');\n\t}\n\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl, LINES_VS, LINES_FS);\n\n\tconst vao = gl.createVertexArray();\n\tif (!vao) {\n\t\tthrow new Error('Failed to create WebGL vertex array');\n\t}\n\n\tgl.bindVertexArray(vao);\n\n\tconst data = new Float32Array([\n\t\t-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,\n\t]);\n\n\tconst vbo = gl.createBuffer();\n\tif (!vbo) {\n\t\tthrow new Error('Failed to create WebGL buffer');\n\t}\n\n\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo);\n\tgl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);\n\n\tconst aPos = gl.getAttribLocation(program, 'aPos');\n\tconst aUv = gl.getAttribLocation(program, 'aUv');","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/lines.ts#L372-L408","documentation":"A plain Error thrown inside setupLines when gl.createVertexArray() returns null. The VAO holds the Lines quad's vertex/uv attribute bindings; without it the effect cannot draw, so setup aborts before uploading geometry.","triggerScenarios":"WebGL2 context exists but cannot allocate a VAO — resource exhaustion or context loss. This runs after the program is linked and before the vertex buffer is created, so it indicates general GL object allocation failure rather than anything param-specific.","commonSituations":"GPU/context resource exhaustion during heavy concurrent rendering; transient context-loss events; environments where VAO extension support is flaky.","solutions":["Reduce concurrent renders / browser contexts.","Handle webglcontextlost and re-run the effect after webglcontextrestored.","Use a render host with a robust WebGL2 implementation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function canAllocateVao(): boolean {\n  const c = document.createElement('canvas');\n  const gl = c.getContext('webgl2');\n  if (!gl) return false;\n  return !!gl.createVertexArray();\n}","typeGuard":null,"tryCatchPattern":"try {\n  lines(...);\n} catch (err) {\n  if (err instanceof Error && /WebGL vertex array/.test(err.message)) {\n    // restart context / lower concurrency, then retry\n  } else throw err;\n}","preventionTips":["Limit concurrent GL contexts so VAOs stay allocatable.","Handle webglcontextlost / webglcontextrestored and tear down/rebuild effects.","Render on a host with a robust WebGL2 implementation."],"tags":["webgl2","lines-effect","gpu","vao","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}