{"record":{"id":"9d57ad4223ec1691","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-9d57ad","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/progressive-pixelate-runtime.ts","lineNumber":210,"sourceCode":"\tconst data = new Float32Array([\n\t\t-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,\n\t]);\n\tconst vbo = gl.createBuffer();\n\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\tgl.enableVertexAttribArray(0);\n\tgl.vertexAttribPointer(0, 2, gl.FLOAT, false, 16, 0);\n\tgl.enableVertexAttribArray(1);\n\tgl.vertexAttribPointer(1, 2, gl.FLOAT, false, 16, 8);\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\tuniforms: {\n\t\t\tuSource: gl.getUniformLocation(program, 'uSource'),\n\t\t\tuResolution: gl.getUniformLocation(program, 'uResolution'),","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/progressive-pixelate-runtime.ts#L192-L228","documentation":"Thrown by setupProgressivePixelate when gl.createTexture() returns null after VAO, VBO, and attribute wiring succeeded. The largest GL resource the effect allocates, so the most likely to fail under memory pressure.","triggerScenarios":"setupProgressivePixelate reaches the texture block; gl.createTexture() returns null.","commonSituations":"Large source frames; many texture-backed effects; mobile/integrated GPUs with small VRAM; SwiftShader on low-memory Lambda; source exceeding MAX_TEXTURE_SIZE.","solutions":["Compare source dimensions to `gl.getParameter(gl.MAX_TEXTURE_SIZE)` and downscale if exceeded.","Lower composition resolution.","Reduce concurrent texture-backed effects.","Increase Lambda function memory.","Confirm `gl.isContextLost()` is false and remount if true."],"exampleFix":"// before\nsetupProgressivePixelate(canvas);\n\n// after — verify texture capacity\nfunction textureFits(gl: WebGL2RenderingContext, w: number, h: number): boolean {\n  const max = gl.getParameter(gl.MAX_TEXTURE_SIZE) as number;\n  return w <= max && h <= max && !gl.isContextLost();\n}","handlingStrategy":"try-catch","validationCode":"function textureCapacityOk(gl: WebGL2RenderingContext, w: number, h: number): boolean {\n  if (gl.isContextLost()) return false;\n  const max = gl.getParameter(gl.MAX_TEXTURE_SIZE) as number;\n  if (w > max || h > max) return false;\n  const t = gl.createTexture();\n  if (t) gl.deleteTexture(t);\n  return t !== null;\n}","typeGuard":null,"tryCatchPattern":"try {\n  setupProgressivePixelate(canvas);\n} catch (err) {\n  if (/Failed to create WebGL texture/.test((err as Error).message)) {\n    // downscale source / reduce resolution, then retry\n  }\n  throw err;\n}","preventionTips":["Keep source dimensions under MAX_TEXTURE_SIZE.","Render at the lowest acceptable resolution.","Limit concurrent texture-backed effects.","Give Lambda enough memory for SwiftShader texture budget."],"tags":["webgl","gpu","progressive-pixelate","texture","memory","environment"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}