BabylonJS/Babylon.js · error
FrameGraphUtilityLayerRendererTask "${this.name}": targetTex
Error message
FrameGraphUtilityLayerRendererTask "${this.name}": targetTexture and camera are required What it means
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.
Source
Thrown at packages/dev/core/src/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.ts:62
* @param scene The scene the task belongs to.
* @param handleEvents If the utility layer should handle events.
*/
constructor(name: string, frameGraph: FrameGraph, scene: Scene, handleEvents = true) {
super(name, frameGraph);
this.layer = new UtilityLayerRenderer(scene, handleEvents, true);
this.layer.utilityLayerScene._useCurrentFrameBuffer = true;
this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();
}
public override getClassName(): string {
return "FrameGraphUtilityLayerRendererTask";
}
public record(): void {
if (!this.targetTexture || !this.camera) {
throw new Error(`FrameGraphUtilityLayerRendererTask "${this.name}": targetTexture and camera are required`);
}
this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);
const pass = this._frameGraph.addRenderPass(this.name);
pass.setRenderTarget(this.outputTexture);
pass.setExecuteFunc((context) => {
context.render(this.layer);
});
const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
passDisabled.setRenderTarget(this.outputTexture);
passDisabled.setExecuteFunc((_context) => {});
}
public override dispose(): void {
View on GitHub (pinned to 0592b347b8)
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.
Example fix
// before utilityLayerTask.targetTexture = frameGraph.backBufferColorTexture; // camera missing // after utilityLayerTask.targetTexture = frameGraph.backBufferColorTexture; utilityLayerTask.camera = scene.activeCamera;
Defensive patterns
Strategy: validation
Validate before calling
if (!utilityTask.targetTexture || !utilityTask.camera) {
throw new Error('UtilityLayerRendererTask requires targetTexture and camera');
} Try / catch
try {
frameGraph.build();
} catch (e) {
if (String(e).includes('targetTexture and camera are required')) {
utilityTask.camera = scene.activeCamera;
frameGraph.build();
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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().
Common situations: 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.
Related errors
- FrameGraphSSAO2Task "${this.name}": sourceTexture, depthText
- FrameGraphSSRRenderingPipelineTask "${this.name}": sourceTex
- FrameGraphSSRTask "${this.name}": sourceTexture, normalTextu
- FrameGraphPostProcessTask "${this.name}": sourceTexture and
- FrameGraphVolumetricLightingBlendVolumeTask "${this.name}":
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/fb9f0edd40150027.
Report an issue: GitHub.