{"record":{"id":"191a4f297eabd0cc","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array-191a4f","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/noise.ts","lineNumber":204,"sourceCode":"\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) {\n\t\tthrow createWebGL2ContextError('noise effect');\n\t}\n\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst vs = compileShader(gl, gl.VERTEX_SHADER, NOISE_VS);\n\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, NOISE_FS);\n\tconst program = linkProgram(gl, vs, fs);\n\tgl.deleteShader(vs);\n\tgl.deleteShader(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":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/noise.ts#L186-L222","documentation":"Thrown by setupNoise (packages/effects/src/noise.ts:204) when gl.createVertexArray() returns null while building the VAO that binds the noise effect's quad attributes. A null VAO means the WebGL2 context is lost or the per-context VAO budget is exhausted.","triggerScenarios":"setupNoise creating the VAO on a lost context or after too many live VAOs; running many noise/WebGL2 effects concurrently without disposing their VAOs.","commonSituations":"Context loss mid-render; long Studio sessions leaking VAOs; GPU memory pressure on integrated graphics; headless render without a real GPU.","solutions":["Run effect cleanup (gl.deleteVertexArray) between usages and limit concurrent WebGL2 effects.","Render on a GPU-capable host with WebGL enabled in headless Chrome.","Check gl.isContextLost() before setup and retry after restoration."],"exampleFix":"// before\nconst vao = gl.createVertexArray(); // null -> throws\n\n// after\nif (gl.isContextLost()) {\n  throw new Error('WebGL2 context lost; cannot create noise VAO');\n}","handlingStrategy":"try-catch","validationCode":"function canCreateNoiseVao(): boolean {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    if (!gl || gl.isContextLost()) return false;\n    const v = gl.createVertexArray();\n    const ok = !!v;\n    if (v) gl.deleteVertexArray(v);\n    return ok;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  scene.push(noise({amount: 0.2}));\n} catch (err) {\n  if (/Failed to create WebGL vertex array/.test(String(err?.message))) {\n    // VAO budget exhausted or context lost: omit the effect\n  } else throw err;\n}","preventionTips":["Delete VAOs via cleanup between usages.","Limit concurrent WebGL2 effects.","Handle webglcontextlost and re-run setup after restore."],"tags":["webgl","gpu","noise","effects","vao","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}