{"record":{"id":"f65de394c095f762","repo":"remotion-dev/remotion","slug":"failed-to-create-exposure-vertex-buffer","errorCode":null,"errorMessage":"Failed to create exposure vertex buffer","messagePattern":"Failed to create exposure vertex buffer","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/exposure.ts","lineNumber":187,"sourceCode":"\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) {\n\t\tthrow createWebGL2ContextError('exposure 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 exposure vertex array');\n\t}\n\n\tconst vbo = gl.createBuffer();\n\tif (!vbo) {\n\t\tthrow new Error('Failed to create exposure 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);\n\tgl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);\n\tgl.enableVertexAttribArray(aUv);\n\tgl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);\n\tgl.bindVertexArray(null);\n","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/exposure.ts#L169-L205","documentation":"Thrown during setupExposure() when gl.createBuffer() returns null (exposure.ts:186-188). A null VBO means the driver declined to allocate another buffer object — context lost or the buffer-object pool exhausted. The fullscreen-quad vertex data has no storage, so exposure setup aborts.","triggerScenarios":"setupExposure() gets past createVertexArray() but gl.createBuffer() returns null. This happens on a lost context or when leaked VBOs from un-cleaned effects have exhausted the driver's buffer-object budget.","commonSituations":"Studio sessions accumulating un-cleaned effect canvases; compositions rendering many WebGL2 effects at once; headless CI with constrained GL resources; contexts reported lost after a GPU crash.","solutions":["Render with --gl=angle (CLI) / chromiumOptions.gl='angle' (SSR) / Angle (Studio).","Guarantee effect cleanup() runs (it calls gl.deleteBuffer); do not retain stale exposure states.","Lower simultaneous WebGL2 effect count and reuse identical exposure() params.","Check gl.isContextLost() and restore before retrying.","Use a render host with adequate GPU memory or a stable software GL path."],"exampleFix":"// before\nconst vbo = gl.createBuffer();\nif (!vbo) {\n  throw new Error('Failed to create exposure vertex buffer');\n}\n\n// after (caller guard)\nif (gl.isContextLost()) {\n  throw new Error('exposure setup aborted: WebGL2 context lost');\n}","handlingStrategy":"try-catch","validationCode":"const canAllocateBuffer = (gl: WebGL2RenderingContext): boolean => {\n  if (gl.isContextLost()) return false;\n  const probe = gl.createBuffer();\n  if (!probe) return false;\n  gl.deleteBuffer(probe);\n  return true;\n};","typeGuard":null,"tryCatchPattern":"try {\n  // apply exposure(); for a custom canvas: const state = setupExposure(canvas);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Failed to create exposure vertex buffer') {\n    // free other effects, restore context, retry on Angle\n    throw err;\n  }\n  throw err;\n}","preventionTips":["Render with Angle (--gl=angle / chromiumOptions.gl='angle').","Ensure cleanup() runs so VBOs are deleted, not leaked.","Limit simultaneous WebGL2 effects; reuse identical exposure() params.","Handle webglcontextlost and restore before retrying."],"tags":["webgl","buffer","vbo","resource-allocation","gpu","exposure","setup"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}