{"record":{"id":"03f4b26aa97785a2","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-03f4b2","errorCode":null,"errorMessage":"Failed to create WebGL texture","messagePattern":"Failed to create WebGL texture","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/rings.ts","lineNumber":333,"sourceCode":"\tgl: WebGL2RenderingContext,\n\tvertexSource: string,\n\tfragmentSource: string,\n): WebGLProgram => {\n\tconst vs = compileShader(gl, gl.VERTEX_SHADER, vertexSource);\n\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);\n\tconst program = linkProgram(gl, vs, fs);\n\tgl.deleteShader(vs);\n\tgl.deleteShader(fs);\n\treturn program;\n};\n\nconst createTexture = (\n\tgl: WebGL2RenderingContext,\n\tfilter: number,\n): WebGLTexture => {\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, filter);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter);\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\treturn texture;\n};\n\nconst setupRings = (target: HTMLCanvasElement): RingsState => {\n\tconst gl = target.getContext('webgl2', {\n\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) {","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/rings.ts#L315-L351","documentation":"Internal error from the `rings()` effect setup: `gl.createTexture()` returned `null` when allocating the source or palette texture. Environment-level allocation failure, not a user-param error. The rings effect creates exactly two textures (source sampler with LINEAR filtering, palette sampler with NEAREST filtering); both run through the same `createTexture` helper.","triggerScenarios":"Context loss mid-setup; GPU texture-memory exhaustion from many simultaneously mounted effects or very large source surfaces; a software GL backend that artificially caps texture object counts.","commonSituations":"Heavy Studio sessions; large-frame renders on memory-constrained GPUs; CI on llvmpipe/SwiftShader.","solutions":["Restart the render or reload the page to reset GPU allocations.","Reduce the number of active effects or the source surface size.","Move to a hardware-accelerated GPU with current drivers.","Listen for `webglcontextlost` and tear down effects to free textures."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const canAllocateTexture = (): boolean => {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    if (!gl) return false;\n    const t = gl.createTexture();\n    if (t) gl.deleteTexture(t);\n    return !!t;\n  } catch {\n    return false;\n  }\n};","typeGuard":null,"tryCatchPattern":"try {\n  rings()({...});\n} catch (err) {\n  if (err instanceof Error && /Failed to create WebGL texture/.test(err.message)) {\n    // reduce active effects and retry after a short delay or reload\n  } else {\n    throw err;\n  }\n}","preventionTips":["Feature-detect texture allocation before mounting many effects.","Reduce concurrent effect count and source surface size.","Free textures via the effect `cleanup` when unmounting.","Handle context loss to release and re-create textures."],"tags":["webgl2","rings-effect","effects","gpu","environment","texture","resource-allocation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}