{"record":{"id":"778ea720c291b849","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-778ea7","errorCode":null,"errorMessage":"Failed to create WebGL texture","messagePattern":"Failed to create WebGL texture","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/noise.ts","lineNumber":232,"sourceCode":"\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');\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.bindVertexArray(null);\n\n\tconst texture = gl.createTexture();\n\tif (!texture) {\n\t\tthrow new Error('Failed to create WebGL texture');\n\t}\n\n\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\tgl.bindTexture(gl.TEXTURE_2D, null);\n\n\treturn {\n\t\tgl,\n\t\tprogram,\n\t\tvao,\n\t\tvbo,\n\t\ttexture,\n\t\tuSource: gl.getUniformLocation(program, 'uSource'),\n\t\tuResolution: gl.getUniformLocation(program, 'uResolution'),\n\t\tuAmount: gl.getUniformLocation(program, 'uAmount'),","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/noise.ts#L214-L250","documentation":"Thrown by setupNoise (packages/effects/src/noise.ts:232) when gl.createTexture() returns null while creating the source texture the noise effect uploads each frame into. Null means context loss, GPU-memory exhaustion, or too many live textures.","triggerScenarios":"noise() applied on a lost context or under GPU-memory pressure; many texture-allocating effects running at once; rendering at very large frame dimensions.","commonSituations":"Integrated GPUs with low texture memory; leaked textures in long sessions; headless software rendering; GPU crash mid-batch.","solutions":["Dispose textures via cleanup between compositions and limit concurrent WebGL2 effects.","Render on a GPU host with WebGL enabled in headless Chrome.","Handle context-loss events and re-render after restore; fall back to no-effect render if allocation keeps failing."],"exampleFix":"// before\nconst texture = gl.createTexture(); // null -> throws\n\n// after\nconst texture = gl.createTexture();\nif (!texture) {\n  throw new Error('noise effect unavailable: cannot allocate WebGL2 texture');\n}","handlingStrategy":"try-catch","validationCode":"function canCreateNoiseTexture(): boolean {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    if (!gl || gl.isContextLost()) return false;\n    const t = gl.createTexture();\n    const ok = !!t;\n    if (t) gl.deleteTexture(t);\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 texture/.test(String(err?.message))) {\n    // texture budget exhausted or context lost: omit the effect\n  } else throw err;\n}","preventionTips":["Delete textures via cleanup between compositions.","Avoid very large frame sizes on low-memory GPUs.","Handle webglcontextlost/restored and use GPU-enabled headless Chrome."],"tags":["webgl","gpu","noise","effects","texture","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}