hyperledger/fabric · error
cannot obtain orderer endpoint, empty endorser list
Error message
cannot obtain orderer endpoint, empty endorser list
What it means
In setOrdererClient, when no orderer address was supplied, the peer attempts to discover one by querying the cscc (configuration system chaincode) via an endorser client. If the client has zero endorser clients configured, there is no peer to ask for the orderer endpoint, so this error is thrown.
Source
Thrown at internal/peer/lifecycle/chaincode/client_connections.go:209
return errors.WithMessage(err, "failed to retrieve client cerificate")
}
c.Certificate = certificate
return nil
}
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")View on GitHub (pinned to 2736b63f8f)
Solutions
- Add at least one --peerAddresses flag (with --tlsRootCertFiles if TLS is on) so an endorser client is created.
- Supply -o/--orderer so the cscc lookup path is skipped entirely.
- Check that --peerAddresses parsing/viper keys are not being overridden by environment variables like CORE_PEER_ADDRESS.
- If constructing ClientConnections in code, populate EndorserClients before calling NewClientConnections.
Example fix
// before peer lifecycle chaincode commit -C mychannel --name mycc --version 1.0 // after peer lifecycle chaincode commit -C mychannel --name mycc --version 1.0 \ --peerAddresses peer0.org1.example.com:7051 \ --tlsRootCertFiles /path/org1.pem \ -o orderer.example.com:7050
Defensive patterns
Strategy: validation
Validate before calling
if !strings.Contains(os.Getenv("CORE_PEER_ADDRESS"), "peer") && ordererFlag == "" {
// ensure at least one --peerAddresses or -o is provided
}
// CLI: require flags before running
// if orderer == "" && len(peerAddresses) == 0 { return errors.New("provide -o or --peerAddresses") } Prevention
- Always pass -o/--orderer on lifecycle chaincode commands.
- Or supply --peerAddresses (and --tlsRootCertFiles when TLS is enabled).
- Script the full flag set once and reuse it across approve/commit.
When it happens
Trigger: Running a lifecycle chaincode command (approve/commit/checkcommitreadiness etc.) without an orderer address (-o / --orderer) and without any peer endorser addresses (--peerAddresses), so NewClientConnections builds a ClientConnections with an empty EndorserClients slice.
Common situations: CLI invocations missing both -o and --peerAddresses flags; scripts that set only the orderer flag but no peers; test harnesses constructing the client struct programmatically without calling the code that appends endorser clients.
Related errors
- no orderer endpoints retrieved for channel %s, pass orderer
- The required parameter 'channelID' is empty. Rerun the comma
- The required parameter 'name' is empty. Rerun the command wi
- The required parameter 'version' is empty. Rerun the command
- The required parameter 'sequence' is empty. Rerun the comman
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/590881f345a91f8d.
Report an issue: GitHub.