{"record":{"id":"8f4ba58ceec69723","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array","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/brand/src/effects/metallic-swirl-effect.ts","lineNumber":552,"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('metallic swirl 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, VERTEX_SHADER);\n\t\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);\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":534,"sourceCodeEnd":570,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/brand/src/effects/metallic-swirl-effect.ts#L534-L570","documentation":"In the `setup` callback, `gl.createVertexArray()` returned `null`. WebGL2 returns null on context loss or resource exhaustion; the program linked successfully before this step, so it is an environment/resource failure. The vertex array object is required to bind the quad geometry.","triggerScenarios":"WebGL2 context lost mid-setup; GPU object limit reached after many effects; broken/incomplete WebGL2 implementation (e.g. a software renderer without VAO support).","commonSituations":"Many metallic-swirl (or other WebGL2) effects mounted simultaneously; leaked VAOs across remounts; virtualized or software WebGL2 backends; long-running sessions.","solutions":["Reduce the number of simultaneously mounted WebGL2 effects.","Ensure effects are unmounted/disposed so their GL resources are freed.","Update GPU drivers / use a hardware-accelerated browser with full VAO support.","Verify the WebGL2 context is healthy before mounting many effects."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const supportsWebGL2 = (): boolean => {\n  try {\n    const c = document.createElement('canvas');\n    return !!c.getContext('webgl2');\n  } catch {\n    return false;\n  }\n};","typeGuard":"const hasHealthyWebGL2 = (canvas: HTMLCanvasElement): boolean => {\n  const gl = canvas.getContext('webgl2');\n  return !!gl && !gl.isContextLost();\n};","tryCatchPattern":"try {\n  metallicSwirl({speed: 1})(...);\n} catch (err) {\n  if (err instanceof Error && /Failed to create WebGL vertex array/.test(err.message)) {\n    // reduce effect count or fall back\n  } else {\n    throw err;\n  }\n}","preventionTips":["Limit simultaneously mounted WebGL2 effects to avoid exhausting VAO slots.","Dispose/unmount effects so GL objects are freed between sequences.","Use a hardware-accelerated browser with full VAO support and current drivers.","Recover on 'webglcontextlost' events."],"tags":["brand","metallic-swirl","webgl","gpu","environment"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}