{"record":{"id":"ddd15c5c33054941","repo":"BabylonJS/Babylon.js","slug":"framegraphcopytobackbuffercolortask-this-name","errorCode":null,"errorMessage":"FrameGraphCopyToBackbufferColorTask \"${this.name}\": sourceTexture is required","messagePattern":"FrameGraphCopyToBackbufferColorTask \"(.+?)\": sourceTexture is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.ts","lineNumber":20,"sourceCode":"import { backbufferColorTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Task which copies a texture to the backbuffer color texture.\r\n */\r\nexport class FrameGraphCopyToBackbufferColorTask extends FrameGraphTask {\r\n    /**\r\n     * The source texture to copy to the backbuffer color texture.\r\n     */\r\n    public sourceTexture: FrameGraphTextureHandle;\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphCopyToBackbufferColorTask\";\r\n    }\r\n\r\n    public record() {\r\n        if (this.sourceTexture === undefined) {\r\n            throw new Error(`FrameGraphCopyToBackbufferColorTask \"${this.name}\": sourceTexture is required`);\r\n        }\r\n\r\n        const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n        pass.addDependencies(this.sourceTexture);\r\n\r\n        pass.setRenderTarget(backbufferColorTextureHandle);\r\n        pass.setExecuteFunc((context) => {\r\n            if (!context.isBackbuffer(this.sourceTexture)) {\r\n                context.copyTexture(this.sourceTexture);\r\n            }\r\n        });\r\n\r\n        const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n        passDisabled.setRenderTarget(backbufferColorTextureHandle);\r\n        passDisabled.setExecuteFunc((_context) => {});\r\n    }\r","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.ts#L2-L38","documentation":"FrameGraphCopyToBackbufferColorTask.record() requires a sourceTexture handle before it can create its render pass that copies a frame graph color texture to the backbuffer. If sourceTexture is undefined there is nothing to copy, so the task throws at record time rather than silently producing an empty output.","triggerScenarios":"Instantiating FrameGraphCopyToBackbufferColorTask and calling frameGraph.addTask(...)/build() without ever assigning task.sourceTexture (e.g. forgetting to wire the previous task's output handle).","commonSituations":"Assembling a frame graph pipeline and forgetting to connect the last rendering task's outputTexture; refactoring that renamed the source task variable leaving the assignment missing; building the graph before the source task creates its output.","solutions":["Assign task.sourceTexture to the output texture handle of the producing task before frameGraph.build().","Ensure the source task is added to the frame graph and records before this copy task in the graph order.","If the copy is conditional, guard build()/record() behind a check that sourceTexture is set."],"exampleFix":"// before\nconst copy = new FrameGraphCopyToBackbufferColorTask('copy');\nfg.addTask(copy);\n// after\nconst copy = new FrameGraphCopyToBackbufferColorTask('copy');\ncopy.sourceTexture = renderTask.outputTexture;\nfg.addTask(copy);","handlingStrategy":"validation","validationCode":"if (copyTask.sourceTexture === undefined) {\n  throw new Error('copyTask.sourceTexture must be wired before frameGraph.build()');\n}","typeGuard":"function hasSourceTexture(t: FrameGraphCopyToBackbufferColorTask): t is FrameGraphCopyToBackbufferColorTask & { sourceTexture: FrameGraphTextureHandle } {\n  return t.sourceTexture !== undefined;\n}","tryCatchPattern":null,"preventionTips":["Wire task inputs immediately after constructing each task, before addTask().","Build the graph in one function so missing connections are easy to spot."],"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"}