{"record":{"id":"b9fbd01cb609a5ee","repo":"remotion-dev/remotion","slug":"failed-to-create-lut-vertex-array","errorCode":null,"errorMessage":"Failed to create LUT vertex array","messagePattern":"Failed to create LUT vertex array","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/effects/src/lut/lut-runtime.ts","lineNumber":118,"sourceCode":"\treturn texture;\n};\n\nexport const setupLut = (target: HTMLCanvasElement): LutState => {\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('LUT 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 LUT vertex array');\n\t}\n\n\tconst vbo = gl.createBuffer();\n\tif (!vbo) {\n\t\tthrow new Error('Failed to create LUT 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\tgl.enableVertexAttribArray(0);\n\tgl.vertexAttribPointer(0, 2, gl.FLOAT, false, 16, 0);\n\tgl.enableVertexAttribArray(1);\n\tgl.vertexAttribPointer(1, 2, gl.FLOAT, false, 16, 8);","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/effects/src/lut/lut-runtime.ts#L100-L136","documentation":"setupLut() calls gl.createVertexArray() to allocate the VAO used for the fullscreen quad that draws the LUT effect. A null return means the WebGL2 context could not create the vertex array object, so the library throws this Error rather than rendering with broken state.","triggerScenarios":"setupLut is invoked while the WebGL2 context is lost or exhausted; the environment's GL implementation (mock, very old driver) returns null from createVertexArray even though WebGL2 declares the API.","commonSituations":"Context loss during offscreen rendering or long renders; emulated/virtualized GPUs with incomplete WebGL2 support; test environments faking WebGL2.","solutions":["Recover from context loss: listen for 'webglcontextrestored' and call setupLut again","Confirm real WebGL2 support: VAOs are core in WebGL2, so a null result signals context problems","Update browser/GPU drivers if using a virtualized or remote GPU","Reduce GL object pressure (delete unused programs/textures/buffers)"],"exampleFix":"// before: no context-loss handling\ncanvas.addEventListener('webglcontextlost', (e) => e.preventDefault());\n// after: re-setup on restore\ncanvas.addEventListener('webglcontextrestored', () => {\n  state = setupLut({ gl, width, height, lutContent });\n});","handlingStrategy":"try-catch","validationCode":"if (gl.isContextLost() || typeof gl.createVertexArray !== 'function') {\n  throw new Error('WebGL2 VAO creation unavailable');\n}","typeGuard":null,"tryCatchPattern":"try {\n  state = setupLut({ gl, width, height, lutContent });\n} catch (e) {\n  if (e.message === 'Failed to create LUT vertex array') {\n    // reinitialize after 'webglcontextrestored'\n  }\n}","preventionTips":["Listen for 'webglcontextrestored' and rebuild the whole LUT state","Avoid virtualized/software GPUs in production rendering environments","Verify real WebGL2 support before rendering","Free unused GL objects promptly"],"tags":["webgl","vao","context-lost","lut"],"backgroundTag":"module-init-failed","analyzedSha":"46a3a6bf13ca367376ff18bbb06dae2e87e0d068","analyzedAt":"2026-09-18T00:12:20.256Z","contentChangedAt":"2026-09-18T00:12:20.256Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}