BabylonJS/Babylon.js · error
Pass "${pass.name}" is not valid. ${errMsg}
Error message
Pass "${pass.name}" is not valid. ${errMsg} What it means
FrameGraphTask._checkTask() validates each pass created by a task's record() by calling pass._isValid(); if a pass reports an error message, the task throws during frameGraph.build(). This instance validates the ENABLED passes list, typically reporting missing/invalid render targets or unset required pass properties.
Source
Thrown at packages/dev/core/src/FrameGraph/frameGraphTask.ts:168
/** @internal */
public _addPass(pass: IFrameGraphPass, disabled: boolean) {
if (disabled) {
this._passesDisabled.push(pass);
} else {
this._passes.push(pass);
}
}
/** @internal */
public _checkTask() {
let outputTexture: Nullable<Nullable<InternalTexture>[]> = null;
let outputDepthTexture: Nullable<InternalTexture> = null;
let outputObjectList: FrameGraphObjectList | undefined;
for (const pass of this._passes) {
const errMsg = pass._isValid();
if (errMsg) {
throw new Error(`Pass "${pass.name}" is not valid. ${errMsg}`);
}
if (FrameGraphRenderPass.IsRenderPass(pass)) {
const handles = Array.isArray(pass.renderTarget) ? pass.renderTarget : [pass.renderTarget];
outputTexture = [];
for (const handle of handles) {
if (handle !== undefined) {
outputTexture.push(this._frameGraph.textureManager.getTextureFromHandle(handle));
}
}
outputDepthTexture = pass.renderTargetDepth !== undefined ? this._frameGraph.textureManager.getTextureFromHandle(pass.renderTargetDepth) : null;
} else if (FrameGraphObjectListPass.IsObjectListPass(pass)) {
outputObjectList = pass.objectList;
}
}
let disabledOutputTexture: Nullable<Nullable<InternalTexture>[]> = null;
let disabledOutputTextureHandle: (FrameGraphTextureHandle | undefined)[] = [];
let disabledOutputDepthTexture: Nullable<InternalTexture> = null;
View on GitHub (pinned to 0592b347b8)
Solutions
- Read errMsg in the thrown message to identify which pass and what check failed.
- Set pass.renderTarget (via pass.setRenderTarget) to valid texture handles in your task's record().
- Ensure all of the task's texture inputs are assigned before build() so passes resolve valid handles.
- Implement/fix _isValid() in custom pass subclasses so it returns null when the pass is fully configured.
Example fix
// before
public record() {
const pass = this._frameGraph.addRenderPass(this.name);
// renderTarget never set -> _isValid() fails
}
// after
public record() {
const pass = this._frameGraph.addRenderPass(this.name);
pass.setRenderTarget(this.targetTexture);
pass.setExecuteFunc((ctx) => { /* ... */ });
} Defensive patterns
Strategy: validation
Validate before calling
// before build(), ensure every enabled pass of each task has a render target
for (const task of tasks) {
for (const pass of task._passes) {
if (FrameGraphRenderPass.IsRenderPass(pass) && pass.renderTarget === undefined) {
throw new Error(`Pass ${pass.name} has no render target`);
}
}
} Try / catch
try {
frameGraph.build();
} catch (e) {
const m = String(e.message).match(/Pass "(.+)" is not valid\. (.+)/);
if (m) {
console.error(`Fix pass ${m[1]}: ${m[2]}`);
} else {
throw e;
}
} Prevention
- Always call pass.setRenderTarget(...) in record() before finishing.
- Assign all task texture inputs before build(); parse the errMsg to locate the broken pass.
When it happens
Trigger: Calling frameGraph.build() where a task's main (enabled) pass _isValid() returns a non-empty error — e.g. a render pass with an undefined renderTarget, a pass referencing a texture handle that can't be resolved, or a pass lacking an execute function setup.
Common situations: Custom tasks creating passes without setting renderTarget; tasks whose input texture assignments were forgotten so their passes hold undefined handles; a pass whose dependency texture was removed during graph refactoring.
Related errors
- FrameGraphClearTextureTask ${this.name}: the depth texture (
- FrameGraphCopyToBackbufferColorTask "${this.name}": sourceTe
- FrameGraphCopyToTextureTask "${this.name}": sourceTexture an
- FrameGraphGenerateMipMapsTask ${this.name}: targetTexture is
- FrameGraphGenerateMipMapsTask ${this.name}: targetTexture mu
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/0b6873ef9d28ac72.
Report an issue: GitHub.