{"record":{"id":"aaee601071601a24","repo":"BabylonJS/Babylon.js","slug":"the-inner-smart-filter-must-have-an-output-connect","errorCode":null,"errorMessage":"The inner smart filter must have an output connected to something","messagePattern":"The inner smart filter must have an output connected to something","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/smartFilters/src/blockFoundation/customAggregateBlock.ts","lineNumber":80,"sourceCode":"\r\n        const attachedBlocks = innerSmartFilter.attachedBlocks;\r\n        for (let index = 0; index < attachedBlocks.length; index++) {\r\n            const block = attachedBlocks[index];\r\n            if (block && block.isInput && block.outputs[0]) {\r\n                // If this input block is connected to anything (has any endpoints), create an input connection point for it\r\n                if (block.outputs[0].endpoints.length > 0) {\r\n                    this._registerSubfilterInput(block.name, block.outputs[0].endpoints.slice(), block.outputs[0].runtimeData ?? null);\r\n                }\r\n\r\n                // Remove this input block from the Smart Filter graph - this will reset the runtimeData to the\r\n                // default for that connection point (which may be null)\r\n                innerSmartFilter.removeBlock(block);\r\n                index--;\r\n            }\r\n        }\r\n\r\n        if (!innerSmartFilter.output.connectedTo) {\r\n            throw new Error(\"The inner smart filter must have an output connected to something\");\r\n        }\r\n\r\n        this._registerSubfilterOutput(\"output\", innerSmartFilter.output.connectedTo);\r\n\r\n        // Disconnect the inner Smart Filter output from the inner Smart Filter\r\n        innerSmartFilter.output.connectedTo.disconnectFrom(innerSmartFilter.output);\r\n    }\r\n}\r\n","sourceCodeStart":62,"sourceCodeEnd":89,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/smartFilters/src/blockFoundation/customAggregateBlock.ts#L62-L89","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Connect the inner Smart Filter's output to a block input (e.g. innerSmartFilter.output.connectTo(blockInput)) before constructing the aggregate.","Inspect the block-removal loop: stop pruning blocks that would leave the inner output unconnected.","Verify the inner filter has at least one downstream block consuming its output.","Validate the inner graph connectivity before wrapping it in CustomAggregateBlock."],"exampleFix":"// before\nconst agg = new CustomAggregateBlock(name, innerFilter); // inner output dangling\n// after\ninnerFilter.output.connectTo(endBlock.input(\"input\"));\nconst agg = new CustomAggregateBlock(name, innerFilter);","handlingStrategy":"validation","validationCode":"if (!innerSmartFilter.output.connectedTo) {\n    throw new Error('inner smart filter output must be connected before building the aggregate');\n}\nnew CustomAggregateBlock(name, innerSmartFilter);","typeGuard":"function innerOutputIsConnected(f: SmartFilter): boolean {\n    return f.output.connectedTo != null;\n}","tryCatchPattern":"try {\n    const agg = new CustomAggregateBlock(name, innerFilter);\n} catch (e) {\n    if (e instanceof Error && e.message.includes('must have an output connected')) {\n        // inspect inner filter graph and connect its output\n    } else throw e;\n}","preventionTips":["Always wire the inner filter output to a consuming block before wrapping.","When pruning inner blocks, re-check output connectivity after each removal.","Add a graph-connectivity unit test for every programmatically built aggregate."],"tags":["smart-filters","aggregate-block","graph-validation"],"backgroundTag":"dangling-output-connection","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}