{"record":{"id":"22edb0fb17a8d70b","repo":"hyperledger/fabric","slug":"no-endorser-clients-retrieved","errorCode":null,"errorMessage":"no endorser clients retrieved","messagePattern":"no endorser clients retrieved","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/client_connections.go","lineNumber":102,"sourceCode":"\tfor i, address := range input.PeerAddresses {\n\t\tvar tlsRootCertFile string\n\t\tif input.TLSRootCertFiles != nil {\n\t\t\ttlsRootCertFile = input.TLSRootCertFiles[i]\n\t\t}\n\t\tendorserClient, err := common.GetEndorserClient(address, tlsRootCertFile)\n\t\tif err != nil {\n\t\t\treturn errors.WithMessagef(err, \"failed to retrieve endorser client for %s\", input.CommandName)\n\t\t}\n\t\tendorserClients = append(endorserClients, endorserClient)\n\t\tdeliverClient, err := common.GetPeerDeliverClient(address, tlsRootCertFile)\n\t\tif err != nil {\n\t\t\treturn errors.WithMessagef(err, \"failed to retrieve deliver client for %s\", input.CommandName)\n\t\t}\n\t\tdeliverClients = append(deliverClients, deliverClient)\n\t}\n\tif len(endorserClients) == 0 {\n\t\t// this should only be empty due to a programming bug\n\t\treturn errors.New(\"no endorser clients retrieved\")\n\t}\n\n\terr := c.setCertificate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.EndorserClients = endorserClients\n\tc.DeliverClients = deliverClients\n\n\treturn nil\n}\n\nfunc (c *ClientConnections) validatePeerConnectionParameters(input *ClientConnectionsInput) error {\n\tif input.ConnectionProfilePath != \"\" {\n\t\terr := input.parseConnectionProfile()\n\t\tif err != nil {\n\t\t\treturn err","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/client_connections.go#L84-L120","documentation":"NewClientConnections builds endorser/deliver clients from the resolved peer connection parameters. This error is a defensive check: endorserClients ended up empty, which per the code comment should only happen due to a programming bug, since normal CLI flows guarantee at least one peer address before clients are created.","triggerScenarios":"setPeerClients completes without returning an error but appends zero endorser clients — internally inconsistent input state (e.g. connection profile resolved to no peers but also bypassed the empty check).","commonSituations":"Very rare for end users; encountered mostly when embedding the lifecycle chaincode package programmatically with a hand-built ClientConnectionsInput, or a connection profile whose channel peer list is empty combined with unusual flags.","solutions":["Verify your flags: pass an explicit --peerAddresses value so at least one endorser is created","If using a connection profile, ensure the channel section lists peers or set --targetPeer","If embedding the library, ensure PeerAddresses is non-empty before calling NewClientConnections","File a bug — the code itself notes this indicates a programming bug"],"exampleFix":"// before\npeer lifecycle chaincode approveformyorg --connectionProfile cp.yaml --channelID mychannel ...  // profile channel has no peers\n// after\npeer lifecycle chaincode approveformyorg --connectionProfile cp.yaml --targetPeer peer0.org1.example.com:7051 ...","handlingStrategy":"validation","validationCode":"// before calling the library\nif len(peerAddresses) == 0 && connectionProfilePeers() == 0 { return errors.New(\"at least one peer address or profile peer is required\") }","typeGuard":"func hasEndorsers(c *chaincode.ClientConnections) bool { return len(c.EndorserClients) > 0 }","tryCatchPattern":"if err := chaincode.NewClientConnections(input); err != nil { if strings.Contains(err.Error(), \"no endorser clients\") { log.Fatal(\"fix input: no peer addresses were resolved\") } return err }","preventionTips":["Always pass --peerAddresses or a complete connection profile","When embedding, set PeerAddresses explicitly before constructing clients","Treat this error as an input-construction bug, not a network issue"],"tags":["fabric","configuration","endorser"],"backgroundTag":"no-endorser-clients","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}