{"record":{"id":"bb20e9b357b84c8c","repo":"BabylonJS/Babylon.js","slug":"max-number-of-connections-for-point-reached","errorCode":null,"errorMessage":"Max number of connections for point reached","messagePattern":"Max number of connections for point reached","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FlowGraph/flowGraphConnection.ts","lineNumber":108,"sourceCode":"\r\n    /**\r\n     * Returns if a point is connected to any other point.\r\n     * @returns boolean indicating if the point is connected.\r\n     */\r\n    public isConnected(): boolean {\r\n        return this._connectedPoint.length > 0;\r\n    }\r\n\r\n    /**\r\n     * Connects two connections together.\r\n     * @param point the connection to connect to.\r\n     */\r\n    public connectTo(point: ConnectedToT): void {\r\n        if (this._connectionType === point._connectionType) {\r\n            throw new Error(`Cannot connect two points of type ${this.connectionType}`);\r\n        }\r\n        if ((this._isSingularConnection() && this._connectedPoint.length > 0) || (point._isSingularConnection() && point._connectedPoint.length > 0)) {\r\n            throw new Error(\"Max number of connections for point reached\");\r\n        }\r\n        this._connectedPoint.push(point);\r\n        point._connectedPoint.push(this);\r\n    }\r\n\r\n    /**\r\n     * Disconnects two connections.\r\n     * @param point the connection to disconnect from.\r\n     * @param removeFromLocal if true, the connection will be removed from the local connection list.\r\n     */\r\n    public disconnectFrom(point: ConnectedToT, removeFromLocal = true): void {\r\n        const indexLocal = this._connectedPoint.indexOf(point);\r\n        const indexConnected = point._connectedPoint.indexOf(this);\r\n        if (indexLocal === -1 || indexConnected === -1) {\r\n            return;\r\n        }\r\n        if (removeFromLocal) {\r\n            this._connectedPoint.splice(indexLocal, 1);\r","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FlowGraph/flowGraphConnection.ts#L90-L126","documentation":"Thrown by connectTo when a point that only allows a single connection (isSingularConnection) is already connected to another point. This guards one-to-one connections from being silently overwritten or turned into one-to-many.","triggerScenarios":"Calling connectTo() on either endpoint when that endpoint is singular (e.g. a signal input, or a data input declared with a single connection) and its _connectedPoint array already has an entry.","commonSituations":"Re-wiring an input that is already connected without disconnecting first; connecting multiple outputs to one signal input; re-running graph-construction code twice.","solutions":["Disconnect the existing connection first before calling connectTo again","Connect to a different point that supports multiple connections","Check the target's _connectedPoint.length === 0 (or equivalent) before connecting"],"exampleFix":"// before\nexistingConnectedInput.connectTo(newOutput); // throws\n// after\nexistingConnectedInput.disconnectFrom(existingConnectedInput._connectedPoint[0]);\nexistingConnectedInput.connectTo(newOutput);","handlingStrategy":"validation","validationCode":"function isFree(p: FlowGraphConnectionPoint): boolean {\n  return !p._isSingularConnection() || p._connectedPoint.length === 0;\n}\nif (isFree(this) && isFree(point)) { this.connectTo(point); }","typeGuard":null,"tryCatchPattern":"try {\n  input.connectTo(output);\n} catch (e) {\n  if (e.message === 'Max number of connections for point reached') {\n    // disconnect existing connection, then retry\n  }\n}","preventionTips":["Disconnect existing connections before rewiring an input","Track connection state in your editor/tooling before issuing connectTo","Avoid re-running idempotent-looking graph setup code without cleanup"],"tags":["flow-graph","babylonjs","connection-limit","api-misuse"],"backgroundTag":"connection-limit-exceeded","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}