BabylonJS/Babylon.js · error · Error

Cannot connect these two connectors. source: "${this.ownerBl

Error message

Cannot connect these two connectors. source: "${this.ownerBlock.name}".${this.name}, target: "${connectionPoint.ownerBlock.name}".${connectionPoint.name}

What it means

NodeMaterialConnectionPoint.connectTo validates compatibility via canConnectTo (type, direction, connection constraints). When the connection is invalid and ignoreConstraints is false, it throws with the names of both endpoints so you can identify the offending edge in your node graph.

Source

Thrown at packages/dev/core/src/Materials/Node/nodeMaterialBlockConnectionPoint.ts:614

            sourceBlock = otherBlock;
        }

        if (targetBlock.isAnAncestorOf(sourceBlock)) {
            return NodeMaterialConnectionPointCompatibilityStates.HierarchyIssue;
        }

        return NodeMaterialConnectionPointCompatibilityStates.Compatible;
    }

    /**
     * Connect this point to another connection point
     * @param connectionPoint defines the other connection point
     * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false)
     * @returns the current connection point
     */
    public connectTo(connectionPoint: NodeMaterialConnectionPoint, ignoreConstraints = false): NodeMaterialConnectionPoint {
        if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) {
            throw new Error(
                `Cannot connect these two connectors. source: "${this.ownerBlock.name}".${this.name}, target: "${connectionPoint.ownerBlock.name}".${connectionPoint.name}`
            );
        }

        this._endpoints.push(connectionPoint);
        connectionPoint._connectedPoint = this;

        this._enforceAssociatedVariableName = false;

        this.onConnectionObservable.notifyObservers(connectionPoint);
        connectionPoint.onConnectionObservable.notifyObservers(this);

        return this;
    }

    /**
     * Disconnect this point from one of his endpoint
     * @param endpoint defines the other connection point

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Check canConnectTo before connecting; only pass ignoreConstraints=true if you know the connection is safe
  2. Print both points' .type and .name to see the mismatch and pick matching points
  3. Insert a converter/cast block between mismatched points
  4. Disconnect the input's existing connection before reconnecting

Example fix

// before
vectorOutput.connectTo(colorInput); // Vector3 -> Color3 mismatch
// after
if (vectorOutput.canConnectTo(colorInput)) {
  vectorOutput.connectTo(colorInput);
} else {
  console.warn('Incompatible points; use a converter block');
}
Defensive patterns

Strategy: validation

Validate before calling

if (!src.canConnectTo(dst)) {
  console.warn(`Incompatible points: ${src.name} (${src.type}) -> ${dst.name} (${dst.type})`);
} else {
  src.connectTo(dst);
}

Type guard

const isConnected = (p: NodeMaterialConnectionPoint): boolean => p.isConnected;

Try / catch

try {
  output.connectTo(input);
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Cannot connect these two connectors')) {
    console.error(e.message); // includes both endpoint names for debugging
  } else throw e;
}

Prevention

When it happens

Trigger: outputPoint.connectTo(inputPoint) where types mismatch (e.g. Vector3 vs Color3), connecting output to output, connecting to an input that already has a connection, or other constraint violations.

Common situations: Programmatic NME graphs where getInputByName returned a wrong-typed point; version changes where a block's point type changed; attempting multiple connections into a single input.

Related errors


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