BabylonJS/Babylon.js · error

The inner smart filter must have an output connected to some

Error message

The inner smart filter must have an output connected to something

What it means

When constructing a CustomAggregateBlock, the inner Smart Filter's output connection point must be connected to something so the aggregate can register its 'output' from the connected point. If innerSmartFilter.output.connectedTo is null/undefined, construction fails immediately.

Source

Thrown at packages/dev/smartFilters/src/blockFoundation/customAggregateBlock.ts:80

        const attachedBlocks = innerSmartFilter.attachedBlocks;
        for (let index = 0; index < attachedBlocks.length; index++) {
            const block = attachedBlocks[index];
            if (block && block.isInput && block.outputs[0]) {
                // If this input block is connected to anything (has any endpoints), create an input connection point for it
                if (block.outputs[0].endpoints.length > 0) {
                    this._registerSubfilterInput(block.name, block.outputs[0].endpoints.slice(), block.outputs[0].runtimeData ?? null);
                }

                // Remove this input block from the Smart Filter graph - this will reset the runtimeData to the
                // default for that connection point (which may be null)
                innerSmartFilter.removeBlock(block);
                index--;
            }
        }

        if (!innerSmartFilter.output.connectedTo) {
            throw new Error("The inner smart filter must have an output connected to something");
        }

        this._registerSubfilterOutput("output", innerSmartFilter.output.connectedTo);

        // Disconnect the inner Smart Filter output from the inner Smart Filter
        innerSmartFilter.output.connectedTo.disconnectFrom(innerSmartFilter.output);
    }
}

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Connect the inner Smart Filter's output to a block input (e.g. innerSmartFilter.output.connectTo(blockInput)) before constructing the aggregate.
  2. Inspect the block-removal loop: stop pruning blocks that would leave the inner output unconnected.
  3. Verify the inner filter has at least one downstream block consuming its output.
  4. Validate the inner graph connectivity before wrapping it in CustomAggregateBlock.

Example fix

// before
const agg = new CustomAggregateBlock(name, innerFilter); // inner output dangling
// after
innerFilter.output.connectTo(endBlock.input("input"));
const agg = new CustomAggregateBlock(name, innerFilter);
Defensive patterns

Strategy: validation

Validate before calling

if (!innerSmartFilter.output.connectedTo) {
    throw new Error('inner smart filter output must be connected before building the aggregate');
}
new CustomAggregateBlock(name, innerSmartFilter);

Type guard

function innerOutputIsConnected(f: SmartFilter): boolean {
    return f.output.connectedTo != null;
}

Try / catch

try {
    const agg = new CustomAggregateBlock(name, innerFilter);
} catch (e) {
    if (e instanceof Error && e.message.includes('must have an output connected')) {
        // inspect inner filter graph and connect its output
    } else throw e;
}

Prevention

When it happens

Trigger: Creating a CustomAggregateBlock whose inner filter output is dangling — no block consumed the inner filter's output, or the connection was removed while pruning inner blocks (see the removal loop just above the throw).

Common situations: Building an aggregate programmatically and forgetting to wire the inner output; dynamically removing blocks that were the only consumers of the inner output; deserializing an incomplete inner graph.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/aaee601071601a24. Report an issue: GitHub.