hyperledger/fabric · error
no server specified
Error message
no server specified
What it means
EndorsersCmd.Execute requires the discovery server address to send the endorsers query. If pc.server is nil or an empty string, there is no endpoint to contact, so the command returns this error after the channel check passes.
Source
Thrown at discovery/cmd/endorsers.go:79
// SetServer sets the server
func (pc *EndorsersCmd) SetServer(server *string) {
pc.server = server
}
// SetChannel sets the channel
func (pc *EndorsersCmd) SetChannel(channel *string) {
pc.channel = channel
}
// Execute executes the command
func (pc *EndorsersCmd) Execute(conf common.Config) error {
if pc.channel == nil || *pc.channel == "" {
return errors.New("no channel specified")
}
if pc.server == nil || *pc.server == "" {
return errors.New("no server specified")
}
server := *pc.server
channel := *pc.channel
ccAndCol := &chaincodesAndCollections{
Chaincodes: pc.chaincodes,
Collections: pc.collections,
NoPrivReads: pc.noPrivReads,
}
cc2collections, err := ccAndCol.parseInput()
if err != nil {
return err
}
var ccCalls []*peer.ChaincodeCall
for _, cc := range *ccAndCol.Chaincodes {View on GitHub (pinned to 2736b63f8f)
Solutions
- Pass --server <host:port> pointing at the discovery service
- Call endorsersCmd.SetServer("peer0.example.com:7051") before Execute in programmatic use
- Ensure deployment scripts/config supply the peer/discovery address
Example fix
// before
endorsersCmd := discovery.NewEndorsersCmd()
endorsersCmd.SetChannel("mychannel")
// after
endorsersCmd := discovery.NewEndorsersCmd()
endorsersCmd.SetChannel("mychannel")
endorsersCmd.SetServer("peer0.example.com:7051") Defensive patterns
Strategy: validation
Validate before calling
if server == "" {
return errors.New("--server is required: discovery service address host:port")
} Type guard
func hasServer(pc *discovery.EndorsersCmd) bool {
return pc.Server != nil && *pc.Server != ""
} Try / catch
if err := endorsersCmd.Execute(conf); err != nil {
if strings.Contains(err.Error(), "no server specified") {
return fmt.Errorf("supply --server host:port: %w", err)
}
return err
} Prevention
- Store the discovery server address in a shared config/env variable
- Validate the address format (host:port) before invoking the command
- Keep server and channel setters adjacent in programmatic usage
When it happens
Trigger: Running the discovery endorsers command without --server, or calling EndorsersCmd.Execute without SetServer.
Common situations: Missing -S/--server (or --peerURL style) flag; peer address loaded from empty env/config; TLS config scripts that set channel but not server.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- no server specified
- no channel specified
- no channel specified
- no server specified
- invocation chain should not be empty
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/12a94070dca37f01.
Report an issue: GitHub.