{"record":{"id":"12dfa561b403b2e7","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-resources-12dfa5","errorCode":null,"errorMessage":"Failed to create WebGL resources","messagePattern":"Failed to create WebGL resources","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/white-noise.ts","lineNumber":162,"sourceCode":"\t\tgl.deleteProgram(program);\n\t\tthrow new Error(info);\n\t}\n\n\treturn program;\n};\n\nconst createWhiteNoiseState = (\n\tgl: WebGL2RenderingContext,\n\tvertexSource: string,\n\tfragmentSource: string,\n): WhiteNoiseState => {\n\tconst program = createProgram(gl, vertexSource, fragmentSource);\n\tconst vao = gl.createVertexArray();\n\tconst vbo = gl.createBuffer();\n\tconst texture = gl.createTexture();\n\n\tif (!vao || !vbo || !texture) {\n\t\tthrow new Error('Failed to create WebGL resources');\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\n\tgl.bindTexture(gl.TEXTURE_2D, texture);","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/white-noise.ts#L144-L180","documentation":"White noise setup allocates three GL objects — vertex array, vertex buffer, and source texture — in one batch and throws 'Failed to create WebGL resources' if any of the three is null. It is a combined guard: the effect needs all three to draw its noise-blended quad, so any single null allocation aborts setup. This is a context/resource failure, not a parameter problem.","triggerScenarios":"createWhiteNoiseState: after the program is built, gl.createVertexArray(), gl.createBuffer(), or gl.createTexture() returns null, failing the `if (!vao || !vbo || !texture)` check on the first frame.","commonSituations":"Lost WebGL2 context; concurrent effects exhausting the GL object pool; headless/CI renderer with degraded WebGL2 allocation; long-running session that leaked GL objects.","solutions":["Confirm a healthy WebGL2 context before applying whiteNoise() (non-null getContext('webgl2'), isContextLost() false).","Render with Remotion's bundled Chromium and enabled software GPU; avoid GPU-disabling flags.","Reduce simultaneously-active WebGL effects so object allocation does not fail.","Handle webglcontextlost by re-mounting the composition to re-run setup.","Update GPU drivers / move to a host with a fully conformant WebGL2 implementation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const gl = document.createElement('canvas').getContext('webgl2');\nconst webglOk =\n  gl != null &&\n  !gl.isContextLost() &&\n  gl.createVertexArray() != null &&\n  gl.createBuffer() != null &&\n  gl.createTexture() != null;","typeGuard":"const canAllocateWhiteNoiseResources = (): boolean => {\n  const gl = document.createElement('canvas').getContext('webgl2');\n  return (\n    gl != null &&\n    !gl.isContextLost() &&\n    gl.createVertexArray() != null &&\n    gl.createBuffer() != null &&\n    gl.createTexture() != null\n  );\n};","tryCatchPattern":"try {\n  return <VideoEffects effects={[whiteNoise({amount: 0.4})]} />;\n} catch (err) {\n  if (err instanceof Error && err.message === 'Failed to create WebGL resources') {\n    return <Video />;\n  }\n  throw err;\n}","preventionTips":["Probe VAO/buffer/texture allocation before mounting whiteNoise().","Render headless with Remotion's bundled Chromium; do not disable the software GPU.","Reduce simultaneously-active WebGL effects to free GL object slots.","Re-mount the composition on webglcontextlost."],"tags":["webgl","gpu","rendering","headless","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}