{"record":{"id":"fb9f0edd40150027","repo":"BabylonJS/Babylon.js","slug":"framegraphutilitylayerrenderertask-this-name","errorCode":null,"errorMessage":"FrameGraphUtilityLayerRendererTask \"${this.name}\": targetTexture and camera are required","messagePattern":"FrameGraphUtilityLayerRendererTask \"(.+?)\": targetTexture and camera are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.ts","lineNumber":62,"sourceCode":"     * @param scene The scene the task belongs to.\r\n     * @param handleEvents If the utility layer should handle events.\r\n     */\r\n    constructor(name: string, frameGraph: FrameGraph, scene: Scene, handleEvents = true) {\r\n        super(name, frameGraph);\r\n\r\n        this.layer = new UtilityLayerRenderer(scene, handleEvents, true);\r\n        this.layer.utilityLayerScene._useCurrentFrameBuffer = true;\r\n\r\n        this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphUtilityLayerRendererTask\";\r\n    }\r\n\r\n    public record(): void {\r\n        if (!this.targetTexture || !this.camera) {\r\n            throw new Error(`FrameGraphUtilityLayerRendererTask \"${this.name}\": targetTexture and camera are 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            context.render(this.layer);\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\n    public override dispose(): void {\r","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.ts#L44-L80","documentation":"FrameGraphUtilityLayerRendererTask.record() needs a targetTexture and a camera to render the utility layer scene. Because the check uses falsy (!) validation, an empty/undefined targetTexture or camera triggers this error, and the output texture handle cannot be resolved without a target.","triggerScenarios":"Recording the utility layer task with targetTexture or camera unset (undefined/null); a dangling target handle that hasn't been assigned from an upstream task; camera created after build().","commonSituations":"Adding the utility layer task for gizmos/overlays and forgetting camera assignment; building the graph before the utility layer render target exists; deleting the camera in a scene teardown/rebuild while the task remains.","solutions":["Set task.targetTexture and task.camera before adding/building the frame graph.","Assign targetTexture from an upstream task's output or frameGraph.backBufferColorTexture.","Verify the camera is created and active before record.","Add a pre-build check that both fields are truthy."],"exampleFix":"// before\nutilityLayerTask.targetTexture = frameGraph.backBufferColorTexture;\n// camera missing\n\n// after\nutilityLayerTask.targetTexture = frameGraph.backBufferColorTexture;\nutilityLayerTask.camera = scene.activeCamera;","handlingStrategy":"validation","validationCode":"if (!utilityTask.targetTexture || !utilityTask.camera) {\n    throw new Error('UtilityLayerRendererTask requires targetTexture and camera');\n}","typeGuard":null,"tryCatchPattern":"try {\n    frameGraph.build();\n} catch (e) {\n    if (String(e).includes('targetTexture and camera are required')) {\n        utilityTask.camera = scene.activeCamera;\n        frameGraph.build();\n    } else throw e;\n}","preventionTips":["Assign camera immediately after constructing the utility layer task.","Default targetTexture to frameGraph.backBufferColorTexture for overlay use cases.","Re-validate task inputs after scene teardown/rebuild cycles."],"tags":["babylonjs","frame-graph","utility-layer","missing-input"],"backgroundTag":"missing-required-input","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}