BabylonJS/Babylon.js · error · Error

Max number of connections for point reached

Error message

Max number of connections for point reached

What it means

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.

Source

Thrown at packages/dev/core/src/FlowGraph/flowGraphConnection.ts:108

    /**
     * Returns if a point is connected to any other point.
     * @returns boolean indicating if the point is connected.
     */
    public isConnected(): boolean {
        return this._connectedPoint.length > 0;
    }

    /**
     * Connects two connections together.
     * @param point the connection to connect to.
     */
    public connectTo(point: ConnectedToT): void {
        if (this._connectionType === point._connectionType) {
            throw new Error(`Cannot connect two points of type ${this.connectionType}`);
        }
        if ((this._isSingularConnection() && this._connectedPoint.length > 0) || (point._isSingularConnection() && point._connectedPoint.length > 0)) {
            throw new Error("Max number of connections for point reached");
        }
        this._connectedPoint.push(point);
        point._connectedPoint.push(this);
    }

    /**
     * Disconnects two connections.
     * @param point the connection to disconnect from.
     * @param removeFromLocal if true, the connection will be removed from the local connection list.
     */
    public disconnectFrom(point: ConnectedToT, removeFromLocal = true): void {
        const indexLocal = this._connectedPoint.indexOf(point);
        const indexConnected = point._connectedPoint.indexOf(this);
        if (indexLocal === -1 || indexConnected === -1) {
            return;
        }
        if (removeFromLocal) {
            this._connectedPoint.splice(indexLocal, 1);

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Disconnect the existing connection first before calling connectTo again
  2. Connect to a different point that supports multiple connections
  3. Check the target's _connectedPoint.length === 0 (or equivalent) before connecting

Example fix

// before
existingConnectedInput.connectTo(newOutput); // throws
// after
existingConnectedInput.disconnectFrom(existingConnectedInput._connectedPoint[0]);
existingConnectedInput.connectTo(newOutput);
Defensive patterns

Strategy: validation

Validate before calling

function isFree(p: FlowGraphConnectionPoint): boolean {
  return !p._isSingularConnection() || p._connectedPoint.length === 0;
}
if (isFree(this) && isFree(point)) { this.connectTo(point); }

Try / catch

try {
  input.connectTo(output);
} catch (e) {
  if (e.message === 'Max number of connections for point reached') {
    // disconnect existing connection, then retry
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: Re-wiring an input that is already connected without disconnecting first; connecting multiple outputs to one signal input; re-running graph-construction code twice.

Related errors


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