{"record":{"id":"12a94070dca37f01","repo":"hyperledger/fabric","slug":"no-server-specified-12a940","errorCode":null,"errorMessage":"no server specified","messagePattern":"no server specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/cmd/endorsers.go","lineNumber":79,"sourceCode":"\n// SetServer sets the server\nfunc (pc *EndorsersCmd) SetServer(server *string) {\n\tpc.server = server\n}\n\n// SetChannel sets the channel\nfunc (pc *EndorsersCmd) SetChannel(channel *string) {\n\tpc.channel = channel\n}\n\n// Execute executes the command\nfunc (pc *EndorsersCmd) Execute(conf common.Config) error {\n\tif pc.channel == nil || *pc.channel == \"\" {\n\t\treturn errors.New(\"no channel specified\")\n\t}\n\n\tif pc.server == nil || *pc.server == \"\" {\n\t\treturn errors.New(\"no server specified\")\n\t}\n\n\tserver := *pc.server\n\tchannel := *pc.channel\n\n\tccAndCol := &chaincodesAndCollections{\n\t\tChaincodes:  pc.chaincodes,\n\t\tCollections: pc.collections,\n\t\tNoPrivReads: pc.noPrivReads,\n\t}\n\tcc2collections, err := ccAndCol.parseInput()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar ccCalls []*peer.ChaincodeCall\n\n\tfor _, cc := range *ccAndCol.Chaincodes {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/cmd/endorsers.go#L61-L97","documentation":"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.","triggerScenarios":"Running the discovery endorsers command without --server, or calling EndorsersCmd.Execute without SetServer.","commonSituations":"Missing -S/--server (or --peerURL style) flag; peer address loaded from empty env/config; TLS config scripts that set channel but not server.","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"],"exampleFix":"// before\nendorsersCmd := discovery.NewEndorsersCmd()\nendorsersCmd.SetChannel(\"mychannel\")\n// after\nendorsersCmd := discovery.NewEndorsersCmd()\nendorsersCmd.SetChannel(\"mychannel\")\nendorsersCmd.SetServer(\"peer0.example.com:7051\")","handlingStrategy":"validation","validationCode":"if server == \"\" {\n    return errors.New(\"--server is required: discovery service address host:port\")\n}","typeGuard":"func hasServer(pc *discovery.EndorsersCmd) bool {\n    return pc.Server != nil && *pc.Server != \"\"\n}","tryCatchPattern":"if err := endorsersCmd.Execute(conf); err != nil {\n    if strings.Contains(err.Error(), \"no server specified\") {\n        return fmt.Errorf(\"supply --server host:port: %w\", err)\n    }\n    return err\n}","preventionTips":["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"],"tags":["go","cli","discovery","missing-argument"],"backgroundTag":"missing-required-argument","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"}