{"record":{"id":"969a377726830438","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-969a37","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/chromatic-aberration/chromatic-aberration-runtime.ts","lineNumber":80,"sourceCode":"};\n\nconst createProgram = (\n\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 createRgbaTexture = (gl: WebGL2RenderingContext): 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, 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\treturn texture;\n};\n\nexport const setupChromaticAberration = (\n\ttarget: HTMLCanvasElement,\n): ChromaticAberrationState => {\n\tconst gl = target.getContext('webgl2', {\n\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/chromatic-aberration/chromatic-aberration-runtime.ts#L62-L98","documentation":"Thrown by createRgbaTexture() in the chromatic aberration runtime when gl.createTexture() returns null. This texture receives each incoming frame (texImage2D) that the chromatic aberration shader samples; a null allocation — lost context or exhausted GPU texture memory — means there is nothing to sample, so setup aborts.","triggerScenarios":"setupChromaticAberration() calls createRgbaTexture() which calls gl.createTexture() at chromatic-aberration-runtime.ts:78; it returns null and the guard at :79 throws.","commonSituations":"GPU texture memory exhausted by many/large compositions, integrated GPU with limited VRAM, software raster under load, or a lost context reached after program creation.","solutions":["Free WebGL resources from other effects before initializing chromatic aberration.","Reduce composition resolution and concurrency to cut texture memory.","Enable real GPU acceleration; avoid --disable-gpu.","Handle context loss/restore and recreate the effect.","Use a GPU/higher-memory instance for server rendering."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function probeWebGL2(): 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  const ok = !!t;\n  if (t) gl.deleteTexture(t);\n  return ok && !gl.isContextLost();\n  } catch {\n  return false;\n  }\n}\nif (!probeWebGL2()) skipOrFallback();","typeGuard":null,"tryCatchPattern":"try {\n  return <ChromaticAberration {...props} />;\n} catch (err) {\n  if (/Failed to create WebGL texture/.test(String(err))) return <FallbackFrame />;\n  throw err;\n}","preventionTips":["Free other effects' textures before initializing chromatic aberration.","Reduce composition resolution and concurrency to cut texture memory.","Prefer GPU-accelerated rendering.","Handle context loss/restore and recreate the effect."],"tags":["webgl","gpu","texture","effects","chromatic-aberration","rendering"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}