{"record":{"id":"99d058b23f78b45a","repo":"BabylonJS/Babylon.js","slug":"framegraphgeneratemipmapstask-this-name-target","errorCode":null,"errorMessage":"FrameGraphGenerateMipMapsTask ${this.name}: targetTexture is required","messagePattern":"FrameGraphGenerateMipMapsTask (.+?): targetTexture is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/Texture/generateMipMapsTask.ts","lineNumber":35,"sourceCode":"\r\n    /**\r\n     * Constructs a new FrameGraphGenerateMipMapsTask.\r\n     * @param name The name of the task.\r\n     * @param frameGraph The frame graph the task belongs to.\r\n     */\r\n    constructor(name: string, frameGraph: FrameGraph) {\r\n        super(name, frameGraph);\r\n\r\n        this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphGenerateMipMapsTask\";\r\n    }\r\n\r\n    public record() {\r\n        if (this.targetTexture === undefined) {\r\n            throw new Error(`FrameGraphGenerateMipMapsTask ${this.name}: targetTexture is required`);\r\n        }\r\n\r\n        this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\r\n\r\n        const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.targetTexture);\r\n\r\n        if (!outputTextureDescription.options.createMipMaps) {\r\n            throw new Error(`FrameGraphGenerateMipMapsTask ${this.name}: targetTexture must have createMipMaps set to true`);\r\n        }\r\n\r\n        const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n        pass.setRenderTarget(this.outputTexture);\r\n        pass.setExecuteFunc((context) => {\r\n            context.generateMipMaps();\r\n        });\r\n\r\n        const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/Texture/generateMipMapsTask.ts#L17-L53","documentation":"FrameGraphGenerateMipMapsTask.record() needs a targetTexture handle to know which texture's mip chain to generate and to resolve its outputTexture handle. Without it, the task cannot set up its pass, so it throws during record.","triggerScenarios":"Adding FrameGenerateMipMapsTask to the frame graph and calling build() without assigning task.targetTexture (the handle of the texture that should receive mipmaps).","commonSituations":"Forgetting to wire the texture created by a preceding render/copy task into the mipmap task; creating the mipmap task in a generic pipeline builder that skips input assignment when a config key is absent.","solutions":["Assign task.targetTexture to the output texture handle of the texture that needs mipmaps before build().","Ensure that texture was created (or imported) via frameGraph texture manager so the handle is valid.","Skip adding the mipmap task when the pipeline config does not request mipmaps."],"exampleFix":"// before\nconst mips = new FrameGraphGenerateMipMapsTask('mips');\nfg.addTask(mips);\n// after\nconst mips = new FrameGraphGenerateMipMapsTask('mips');\nmips.targetTexture = copyTask.outputTexture;\nfg.addTask(mips);","handlingStrategy":"validation","validationCode":"if (mipTask.targetTexture === undefined) {\n  throw new Error('mipTask.targetTexture must be set before frameGraph.build()');\n}","typeGuard":"function hasTarget(t: FrameGraphGenerateMipMapsTask): t is FrameGraphGenerateMipMapsTask & { targetTexture: FrameGraphTextureHandle } {\n  return t.targetTexture !== undefined;\n}","tryCatchPattern":null,"preventionTips":["Set targetTexture right after constructing the mipmap task.","Only add the mipmap task when the source texture pipeline actually produces a texture."],"tags":["babylonjs","framegraph","missing-assignment","mipmap"],"backgroundTag":"required-input-not-set","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}