{"record":{"id":"4d4968d68fcc1305","repo":"hyperledger/fabric","slug":"no-endorser-clients-retrieved-this-might-indicat","errorCode":null,"errorMessage":"no endorser clients retrieved - this might indicate a bug","messagePattern":"no endorser clients retrieved - this might indicate a bug","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/chaincode/common.go","lineNumber":395,"sourceCode":"\t\t}\n\t\tfor i, address := range peerAddresses {\n\t\t\tvar tlsRootCertFile string\n\t\t\tif tlsRootCertFiles != nil {\n\t\t\t\ttlsRootCertFile = tlsRootCertFiles[i]\n\t\t\t}\n\t\t\tendorserClient, err := common.GetEndorserClientFnc(address, tlsRootCertFile)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.WithMessagef(err, \"error getting endorser client for %s\", cmdName)\n\t\t\t}\n\t\t\tendorserClients = append(endorserClients, endorserClient)\n\t\t\tdeliverClient, err := common.GetPeerDeliverClientFnc(address, tlsRootCertFile)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.WithMessagef(err, \"error getting deliver client for %s\", cmdName)\n\t\t\t}\n\t\t\tdeliverClients = append(deliverClients, deliverClient)\n\t\t}\n\t\tif len(endorserClients) == 0 {\n\t\t\treturn nil, errors.New(\"no endorser clients retrieved - this might indicate a bug\")\n\t\t}\n\t}\n\tcertificate, err := common.GetClientCertificateFnc()\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"error getting client certificate\")\n\t}\n\n\tsigner, err := common.GetDefaultSignerFnc()\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"error getting default signer\")\n\t}\n\n\tvar broadcastClient common.BroadcastClient\n\tif isOrdererRequired {\n\t\tif len(common.OrderingEndpoint) == 0 {\n\t\t\tif len(endorserClients) == 0 {\n\t\t\t\treturn nil, errors.New(\"orderer is required, but no ordering endpoint or endorser client supplied\")\n\t\t\t}","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/chaincode/common.go#L377-L413","documentation":"InitCmdFactory builds the client factory (endorser, deliver, broadcast clients) for peer chaincode commands. When the endorser is required, it iterates over the configured --peerAddresses and appends successfully created endorser clients; if none were created, it throws this error because it is assumed validatePeerConnectionParameters guarantees at least one address, so an empty list indicates a bug.","triggerScenarios":"Calling chaincode invoke/query with isEndorserRequired=true while the endorserClients slice ends up empty after the peerAddresses loop — e.g. peerAddresses was emptied by test hook overrides (GetEndorserClientFnc returning nil,nil) or the address loop silently skipped all entries.","commonSituations":"Custom builds or tests that swap GetEndorserClientFnc; embedding the peer CLI library and clearing global peerAddresses; internal regressions in validatePeerConnectionParameters.","solutions":["Verify --peerAddresses (and --tlsRootCertFiles) are set and that validatePeerConnectionParameters passes before InitCmdFactory","Check whether any code/test has overridden common.GetEndorserClientFnc and restore the default","Upgrade to a fixed Fabric version if this occurs with valid flags, as it indicates a code bug","File a bug with the command flags and stack context if the standard CLI reproduces it"],"exampleFix":"// before (hook override in test/setup leaving no clients)\ncommon.GetEndorserClientFnc = func(...) (pb.EndorserClient, error) { return nil, nil }\n// after\ncommon.GetEndorserClientFnc = common.GetEndorserClient // restore default","handlingStrategy":"validation","validationCode":"if len(peerAddresses) == 0 {\n    return fmt.Errorf(\"at least one --peerAddresses is required for invoke/query\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --peerAddresses explicitly in scripts","Do not override common.GetEndorserClientFnc outside tests","Keep validatePeerConnectionParameters intact when embedding the CLI package"],"tags":["fabric","peer-cli","endorser","internal-bug"],"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"}