hyperledger/fabric · error
'%s' command supports one peer. %d peers provided
Error message
'%s' command supports one peer. %d peers provided
What it means
Most lifecycle chaincode subcommands target exactly one endorsing peer. This error fires when the user supplied more than one --peerAddresses value to a command that is not approveformyorg or commit (the two commands that allow multiple peers).
Source
Thrown at internal/peer/lifecycle/chaincode/client_connections.go:131
return nil
}
func (c *ClientConnections) validatePeerConnectionParameters(input *ClientConnectionsInput) error {
if input.ConnectionProfilePath != "" {
err := input.parseConnectionProfile()
if err != nil {
return err
}
}
// currently only support multiple peer addresses for _lifecycle
// for approveformyorg and commit
multiplePeersAllowed := map[string]bool{
"approveformyorg": true,
"commit": true,
}
if !multiplePeersAllowed[input.CommandName] && len(input.PeerAddresses) > 1 {
return errors.Errorf("'%s' command supports one peer. %d peers provided", input.CommandName, len(input.PeerAddresses))
}
if !input.TLSEnabled {
input.TLSRootCertFiles = nil
return nil
}
if len(input.TLSRootCertFiles) != len(input.PeerAddresses) {
return errors.Errorf("number of peer addresses (%d) does not match the number of TLS root cert files (%d)", len(input.PeerAddresses), len(input.TLSRootCertFiles))
}
return nil
}
func (c *ClientConnectionsInput) parseConnectionProfile() error {
networkConfig, err := common.GetConfig(c.ConnectionProfilePath)
if err != nil {
return err
}View on GitHub (pinned to 2736b63f8f)
Solutions
- Use a single --peerAddresses flag for this command
- If you truly need multiple peers, use approveformyorg or commit, which allow multiple
- Remove extra --peerAddresses/--tlsRootCertFiles pairs from your script for this subcommand
Example fix
// before peer lifecycle chaincode checkcommitreadiness --peerAddresses peer0.org1:7051 --peerAddresses peer0.org2:7051 ... // after peer lifecycle chaincode checkcommitreadiness --peerAddresses peer0.org1:7051 ...
Defensive patterns
Strategy: validation
Validate before calling
multiPeerAllowed := map[string]bool{"approveformyorg": true, "commit": true}
if len(peerAddresses) > 1 && !multiPeerAllowed[commandName] { return fmt.Errorf("%s supports one peer", commandName) } Try / catch
if err := run(cmd); err != nil && strings.Contains(err.Error(), "supports one peer") { log.Fatalf("drop extra --peerAddresses flags for %s", cmd) } Prevention
- Only repeat --peerAddresses for approveformyorg and commit
- Build peer lists per-command in scripts, not globally
- Count flags before exec to catch duplicates
When it happens
Trigger: Passing two or more --peerAddresses flags to commands like checkcommitreadiness, package, install, queryinstalled, getinstalledpackage, or approveformyorg/commit are the only multi-peer exceptions.
Common situations: Copy-pasting a multi-peer invocation pattern from approveformyorg/commit examples onto another subcommand; scripting loops that always append multiple peer addresses.
Related errors
- trailing args detected: %s
- number of peer addresses (%d) does not match the number of T
- too few arguments
- chaincode type not supported: %s
- incorrect number of arguments
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/d508ebc859f964b5.
Report an issue: GitHub.