hyperledger/fabric · error

invalid endpoint for chaincode to connect

Error message

invalid endpoint for chaincode to connect

What it means

computeChaincodeEndpoint Case D: neither chaincodeAddress nor chaincodeListenAddress nor the peer address yields a usable advertiseable address — all are unset or bound to the wildcard 0.0.0.0/::, so the peer cannot tell chaincode containers how to reach it.

Source

Thrown at internal/peer/node/start.go:1117

// address (these two are from viper) and peer address to compute chaincode endpoint.
// There could be following cases of computing chaincode endpoint:
// Case A: if chaincodeAddrKey is set, use it if not "0.0.0.0" (or "::")
// Case B: else if chaincodeListenAddressKey is set and not "0.0.0.0" or ("::"), use it
// Case C: else use peer address if not "0.0.0.0" (or "::")
// Case D: else return error
func computeChaincodeEndpoint(chaincodeAddress string, chaincodeListenAddress string, peerHostname string) (ccEndpoint string, err error) {
	logger.Infof("Entering computeChaincodeEndpoint with peerHostname: %s", peerHostname)
	// Case A: the chaincodeAddrKey is set
	if chaincodeAddress != "" {
		host, _, err := net.SplitHostPort(chaincodeAddress)
		if err != nil {
			logger.Errorf("Fail to split chaincodeAddress: %s", err)
			return "", err
		}
		ccIP := net.ParseIP(host)
		if ccIP != nil && ccIP.IsUnspecified() {
			logger.Errorf("ChaincodeAddress' IP cannot be %s in non-dev mode", ccIP)
			return "", errors.New("invalid endpoint for chaincode to connect")
		}
		logger.Infof("Exit with ccEndpoint: %s", chaincodeAddress)
		return chaincodeAddress, nil
	}

	// Case B: chaincodeListenAddrKey is set
	if chaincodeListenAddress != "" {
		ccEndpoint = chaincodeListenAddress
		host, port, err := net.SplitHostPort(ccEndpoint)
		if err != nil {
			logger.Errorf("ChaincodeAddress is nil and fail to split chaincodeListenAddress: %s", err)
			return "", err
		}

		ccListenerIP := net.ParseIP(host)
		// ignoring other values such as Multicast address etc ...as the server
		// wouldn't start up with this address anyway
		if ccListenerIP != nil && ccListenerIP.IsUnspecified() {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Set peer.address to a non-wildcard routable hostname/IP
  2. Or configure peer.chaincodeAddress to an explicit external address
  3. Or set peer.chaincodeListenAddress to a specific non-wildcard address
  4. Ensure the chosen address is reachable from chaincode containers (e.g., host.docker.internal on Docker Desktop)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/peer/node/start.go:1117 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/f7e2511c26d56be7. Report an issue: GitHub.