{"record":{"id":"268c9b24b41adc6e","repo":"BabylonJS/Babylon.js","slug":"framegraphguitask-targettexture-is-required","errorCode":null,"errorMessage":"FrameGraphGUITask: targetTexture is required","messagePattern":"FrameGraphGUITask: targetTexture is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/gui/src/2D/FrameGraph/guiTask.ts","lineNumber":69,"sourceCode":"        } else {\r\n            adt = AdvancedDynamicTexture.CreateFullscreenUI(name, undefined, { useStandalone: true, scene: frameGraph.scene });\r\n        }\r\n        this._adt = adt;\r\n\r\n        this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n    }\r\n\r\n    public override isReady() {\r\n        return this._adt.guiIsReady() && this._adt._layerToDispose!.isReady();\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphGUITask\";\r\n    }\r\n\r\n    public record(): void {\r\n        if (this.targetTexture === undefined) {\r\n            throw new Error(\"FrameGraphGUITask: targetTexture is required\");\r\n        }\r\n\r\n        this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\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            this._adt._checkUpdate(null);\r\n            context.render(this._adt._layerToDispose!);\r\n        });\r\n\r\n        const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n        passDisabled.setRenderTarget(this.outputTexture);\r\n        passDisabled.setExecuteFunc((_context) => {});\r\n    }\r\n\r","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/gui/src/2D/FrameGraph/guiTask.ts#L51-L87","documentation":"FrameGraphGUITask.record() renders the GUI into a frame-graph texture pass. Before recording, it verifies that a target texture handle has been assigned; without one the render pass has nowhere to write and downstream handle resolution (resolveDanglingHandle) would be meaningless, so the library throws immediately.","triggerScenarios":"Calling frameGraphTask.record() on a FrameGraphGUITask whose targetTexture property is still undefined — i.e. the task was constructed and added to the FrameGraph but targetTexture (typically the output of a texture creation task) was never set.","commonSituations":"Building a FrameGraph pipeline and forgetting to wire the GUI task to a render target texture; copy-pasting GUI task setup from a non-framegraph flow; ordering mistakes where the texture task has not yet been built/consumed before GUI record is invoked.","solutions":["Set guiTask.targetTexture = <texture handle> (e.g. the output of frameGraph.createRenderTargetTexture(...) or another task's output) before calling record().","Verify task wiring order: the texture-producing task must be created and its output assigned to the GUI task before the record phase.","Add a guard/assert in your pipeline setup that all render tasks have a target texture before frameGraph.build() / execute()."],"exampleFix":"// before\nconst guiTask = new FrameGraphGUITask(\"gui\", frameGraph, adt);\nframeGraph.addTask(guiTask);\nguiTask.record(); // throws\n\n// after\nconst guiTask = new FrameGraphGUITask(\"gui\", frameGraph, adt);\nconst target = frameGraph.createRenderTargetTexture(\"guiTarget\", { size: { width, height } });\nguiTask.targetTexture = target;\nframeGraph.addTask(guiTask);\nguiTask.record();","handlingStrategy":"validation","validationCode":"if (guiTask.targetTexture === undefined) {\n    throw new Error(\"GUI task must have targetTexture set before record()\");\n}\nguiTask.record();","typeGuard":"function hasTargetTexture(t: FrameGraphGUITask): boolean {\n    return t.targetTexture !== undefined;\n}","tryCatchPattern":"try {\n    guiTask.record();\n} catch (e) {\n    if (e instanceof Error && e.message.includes(\"targetTexture is required\")) {\n        console.error(\"FrameGraphGUITask not wired to a texture:\", e);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Assign targetTexture immediately after constructing the task, before addTask/record.","Write a pipeline-setup validator that asserts every render task has a target texture before frameGraph.build().","Keep texture creation and task wiring in one setup function to avoid ordering mistakes."],"tags":["framegraph","render-pipeline","gui","missing-configuration"],"backgroundTag":"required-property-not-set","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}