{"record":{"id":"ed6ffb2956f6b3dc","repo":"remotion-dev/remotion","slug":"failed-to-create-white-balance-vertex-array","errorCode":null,"errorMessage":"Failed to create white balance vertex array","messagePattern":"Failed to create white balance vertex array","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/white-balance.ts","lineNumber":197,"sourceCode":"\treturn texture;\n};\n\nconst setupWhiteBalance = (target: HTMLCanvasElement): WhiteBalanceState => {\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('white balance effect');\n\t}\n\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl);\n\tconst vao = gl.createVertexArray();\n\tif (!vao) {\n\t\tthrow new Error('Failed to create white balance vertex array');\n\t}\n\n\tconst vbo = gl.createBuffer();\n\tif (!vbo) {\n\t\tthrow new Error('Failed to create white balance vertex buffer');\n\t}\n\n\tgl.bindVertexArray(vao);\n\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo);\n\tgl.bufferData(\n\t\tgl.ARRAY_BUFFER,\n\t\tnew Float32Array([-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1]),\n\t\tgl.STATIC_DRAW,\n\t);\n\n\tconst aPos = gl.getAttribLocation(program, 'aPos');\n\tconst aUv = gl.getAttribLocation(program, 'aUv');\n\tgl.enableVertexAttribArray(aPos);","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/white-balance.ts#L179-L215","documentation":"During white balance setup the effect creates a VAO (gl.createVertexArray) to bind its fullscreen-quad attribute layout. A null return means the WebGL2 implementation could not allocate the vertex-array object, which the effect cannot proceed without because all draw calls depend on that VAO being bound. Like the other null-resource throws, it reflects a degraded/lost GL context rather than bad input.","triggerScenarios":"setupWhiteBalance runs on the first frame, calls gl.createVertexArray(), and the context returns null — typically because the context was lost, VAO object limits are hit, or the backend is a software renderer with incomplete WebGL2 support.","commonSituations":"Rendering in a headless/CI environment with a SwiftShader or blocklisted GPU; many concurrent effect-bearing compositions exhausting GL object quotas; a context-loss event firing mid-session; older virtual/GPU-forwarding setups with partial VAO support.","solutions":["Confirm the render environment exposes a healthy WebGL2 context (getContext('webgl2') non-null, isContextLost() false).","Use Remotion's bundled Chrome for Lambda/headless rendering instead of a system Chromium that may disable GPU features.","Lower the count of simultaneously-active WebGL effects so the GL object pool is not exhausted.","Handle webglcontextlost and tear down/recreate the composition so setup re-runs against a fresh context.","Update GPU drivers or move off a pure-software rendering backend."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const gl = document.createElement('canvas').getContext('webgl2');\nconst webglOk = gl != null && gl.createVertexArray() != null && !gl.isContextLost();","typeGuard":"const canAllocateVAO = (): boolean => {\n  const gl = document.createElement('canvas').getContext('webgl2');\n  return gl != null && !gl.isContextLost() && gl.createVertexArray() != null;\n};","tryCatchPattern":"try {\n  return <VideoEffects effects={[whiteBalance({tint: 0.2})]} />;\n} catch (err) {\n  if (err instanceof Error && /white balance vertex array/.test(err.message)) {\n    return <Video />; // degrade gracefully\n  }\n  throw err;\n}","preventionTips":["Probe WebGL2 and a sample VAO allocation before relying on effects.","Render with Remotion's bundled Chrome and its enabled software GPU.","Reduce concurrent WebGL effects to free VAO slots.","Re-mount the composition after webglcontextlost."],"tags":["webgl","gpu","rendering","headless","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}