hyperledger/fabric · error

no orderer endpoints retrieved for channel %s, pass orderer

Error message

no orderer endpoints retrieved for channel %s, pass orderer endpoint with -o flag instead

What it means

After successfully querying cscc for the channel's orderer endpoints, the returned list was empty — the channel configuration contains no orderer endpoints the peer can use. The client refuses to proceed and tells the user to provide the orderer explicitly with -o.

Source

Thrown at internal/peer/lifecycle/chaincode/client_connections.go:217

func (c *ClientConnections) setOrdererClient() error {
	oe := viper.GetString("orderer.address")
	if oe == "" {
		// if we're here we didn't get an orderer endpoint from the command line
		// so we'll attempt to get one from cscc - bless it
		if c.Signer == nil {
			return errors.New("cannot obtain orderer endpoint, no signer was configured")
		}

		if len(c.EndorserClients) == 0 {
			return errors.New("cannot obtain orderer endpoint, empty endorser list")
		}

		orderingEndpoints, err := common.GetOrdererEndpointOfChainFnc(channelID, c.Signer, c.EndorserClients[0], c.CryptoProvider)
		if err != nil {
			return errors.WithMessagef(err, "error getting channel (%s) orderer endpoint", channelID)
		}
		if len(orderingEndpoints) == 0 {
			return errors.Errorf("no orderer endpoints retrieved for channel %s, pass orderer endpoint with -o flag instead", channelID)
		}

		logger.Infof("Retrieved channel (%s) orderer endpoint: %s", channelID, orderingEndpoints[0])
		// override viper env
		viper.Set("orderer.address", orderingEndpoints[0])
	}

	broadcastClient, err := common.GetBroadcastClient()
	if err != nil {
		return errors.WithMessage(err, "failed to retrieve broadcast client")
	}

	c.BroadcastClient = broadcastClient

	return nil
}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Pass the orderer explicitly with -o/--orderer (e.g. -o orderer.example.com:7050).
  2. Verify the channel name with -C matches a channel the peer is joined to and that its config block contains orderer endpoints.
  3. Inspect the channel config (peer channel fetch config) to confirm orderer endpoints are present.
  4. Re-add or correct the OrdererAddresses entry in the channel configuration if it is genuinely missing.

Example fix

// before
peer lifecycle chaincode approveformyorg -C mychannel --name mycc
// after
peer lifecycle chaincode approveformyorg -C mychannel --name mycc -o orderer.example.com:7050
Defensive patterns

Strategy: fallback

Validate before calling

endpoints, err := common.GetOrdererEndpointOfChainFnc(channelID, signer, endorser, cryptoProvider)
if err != nil || len(endpoints) == 0 {
    // fall back to explicit orderer flag value
    endpoints = []string{ordererFlag}
}

Type guard

func hasOrdererEndpoints(eps []string) bool { return len(eps) > 0 }

Prevention

When it happens

Trigger: setOrdererClient calls GetOrdererEndpointOfChainFnc and it returns an empty list of ordering endpoints for the given channelID.

Common situations: Channel config missing orderer endpoints or the peer cannot read them (ordering service removed/renamed in config); querying a channel that exists but has no orderer group; stale or wrong channel name passed with -C.

Related errors


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