{"record":{"id":"2e647745b63fef4c","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-2e6477","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/checkerboard.ts","lineNumber":334,"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 setupCheckerboard = (target: HTMLCanvasElement): CheckerboardState => {\n\tconst gl = target.getContext('webgl2', {\n\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) {","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/checkerboard.ts#L316-L352","documentation":"Thrown by createTexture() (checkerboard helper) when gl.createTexture() returns null. The checkerboard effect allocates two textures (source at LINEAR and palette at NEAREST); if either allocation returns null — lost context or GPU texture memory exhausted — setup aborts. Without textures the shader cannot sample the frame or the palette.","triggerScenarios":"setupCheckerboard() calls createTexture() at checkerboard.ts:332 (via createTexture(gl, gl.LINEAR) / createTexture(gl, gl.NEAREST) at :401-402); gl.createTexture() returns null and the guard at :333 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":["Reduce concurrent compositions and free unused GL resources before setup.","Lower composition resolution to cut texture footprint.","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  // probe a texture allocation\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 <Checkerboard {...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 checkerboard.","Lower composition resolution to cut texture footprint.","Prefer GPU-accelerated rendering.","Handle context loss/restore and recreate the effect."],"tags":["webgl","gpu","texture","effects","checkerboard","rendering"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}