{"record":{"id":"2b39db67dee28bec","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array-2b39db","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/shrinkwrap.ts","lineNumber":468,"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('shrinkwrap 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, SHRINKWRAP_VS);\n\t\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, SHRINKWRAP_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":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/shrinkwrap.ts#L450-L486","documentation":"The shrinkwrap() effect's setup function calls gl.createVertexArray() to create a VAO for its fullscreen quad. If the WebGL2 context returns null, the effect throws this Error. This indicates GPU resource starvation or a context in a degraded state — the context exists but cannot allocate a vertex array object.","triggerScenarios":"Calling shrinkwrap() in an environment where WebGL2 VAO allocation fails: headless Chrome without GPU acceleration, GPU memory exhaustion from many concurrent effects, or a context that experienced a loss event after creation.","commonSituations":"CI runners with SwiftShader software rendering; Remotion Lambda with a misconfigured Chrome layer; high-concurrency rendering with many simultaneous WebGL2 contexts; transient context loss during setup.","solutions":["Ensure GPU-accelerated WebGL2 is available in the render environment.","Reduce concurrency to limit simultaneous WebGL2 contexts.","Handle 'webglcontextlost' events and retry rendering after restoration.","Upgrade GPU drivers or use a host with hardware WebGL2 support."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// Probe VAO allocation capability\nfunction canCreateVao(canvas: HTMLCanvasElement): boolean {\n  const gl = canvas.getContext('webgl2');\n  if (!gl) return false;\n  const vao = gl.createVertexArray();\n  const ok = vao !== null;\n  if (vao) gl.deleteVertexArray(vao);\n  return ok;\n}","typeGuard":"null","tryCatchPattern":"try {\n  shrinkwrap({ amount: 1 });\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to create WebGL vertex array') {\n    console.warn('WebGL2 VAO allocation failed for shrinkwrap');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Ensure GPU-accelerated WebGL2 is available.","Reduce concurrency to limit simultaneous VAO allocations.","Handle context-loss events.","Keep GPU drivers updated."],"tags":["webgl2","gpu","resource-allocation","vao","headless"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}