{"record":{"id":"3e3b73e839703aa2","repo":"BabylonJS/Babylon.js","slug":"framegraphcopytotexturetask-this-name-source","errorCode":null,"errorMessage":"FrameGraphCopyToTextureTask \"${this.name}\": sourceTexture and targetTexture are required","messagePattern":"FrameGraphCopyToTextureTask \"(.+?)\": sourceTexture and targetTexture are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/Texture/copyToTextureTask.ts","lineNumber":54,"sourceCode":"\r\n    /**\r\n     * Constructs a new FrameGraphCopyToTextureTask.\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 \"FrameGraphCopyToTextureTask\";\r\n    }\r\n\r\n    public record() {\r\n        if (this.sourceTexture === undefined || this.targetTexture === undefined) {\r\n            throw new Error(`FrameGraphCopyToTextureTask \"${this.name}\": sourceTexture and targetTexture 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        const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n        pass.addDependencies(this.sourceTexture);\r\n        passDisabled.addDependencies(this.sourceTexture);\r\n\r\n        const textureDescription = this._frameGraph.textureManager.getTextureDescription(this.targetTexture);\r\n        const targetIsDepthTexture = IsDepthTexture(textureDescription.options.formats![0]);\r\n\r\n        if (targetIsDepthTexture) {\r\n            pass.setRenderTargetDepth(this.outputTexture);\r\n            passDisabled.setRenderTargetDepth(this.outputTexture);\r\n        } else {\r\n            pass.setRenderTarget(this.outputTexture);\r","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/Texture/copyToTextureTask.ts#L36-L72","documentation":"FrameGraphCopyToTextureTask.record() requires both a sourceTexture and a targetTexture handle because it creates a copy pass between two GPU textures. If either is undefined the pass has no valid source or destination, so the task throws immediately during record.","triggerScenarios":"Adding FrameGraphCopyToTextureTask to a frame graph and calling build() with only sourceTexture set, only targetTexture set, or neither.","commonSituations":"Copy pipelines (e.g. for post-processing or readback) where one endpoint of the copy was not wired; a texture-producing task removed or renamed leaving a dangling undefined handle; conditional pipelines that skip creating the target texture.","solutions":["Set both task.sourceTexture and task.targetTexture to valid frame graph texture handles before build().","Verify the producing tasks are added to the graph and their outputTextures are assigned to this task's inputs.","Remove the task entirely if the copy is no longer needed."],"exampleFix":"// before\ncopyTask.sourceTexture = blurTask.outputTexture;\nfg.addTask(copyTask);\n// after\ncopyTask.sourceTexture = blurTask.outputTexture;\ncopyTask.targetTexture = fg.createTexture({ name: 'copyTarget', options: { ... } });\nfg.addTask(copyTask);","handlingStrategy":"validation","validationCode":"if (copyTask.sourceTexture === undefined || copyTask.targetTexture === undefined) {\n  throw new Error('copyTask needs both sourceTexture and targetTexture before build()');\n}","typeGuard":"function isCopyReady(t: { sourceTexture?: unknown; targetTexture?: unknown }): boolean {\n  return t.sourceTexture !== undefined && t.targetTexture !== undefined;\n}","tryCatchPattern":null,"preventionTips":["Assign both endpoints of a copy at the same call site to avoid half-wired tasks.","Keep a checklist of task inputs when building pipeline graphs."],"tags":["babylonjs","framegraph","missing-assignment","texture"],"backgroundTag":"required-input-not-set","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}