{"record":{"id":"3c810ecd634a5cce","repo":"hyperledger/fabric","slug":"no-server-specified","errorCode":null,"errorMessage":"no server specified","messagePattern":"no server specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/cmd/config.go","lineNumber":48,"sourceCode":"\tserver  *string\n\tchannel *string\n\tparser  ResponseParser\n}\n\n// SetServer sets the server of the ConfigCmd\nfunc (pc *ConfigCmd) SetServer(server *string) {\n\tpc.server = server\n}\n\n// SetChannel sets the channel of the ConfigCmd\nfunc (pc *ConfigCmd) SetChannel(channel *string) {\n\tpc.channel = channel\n}\n\n// Execute executes the command\nfunc (pc *ConfigCmd) Execute(conf common.Config) error {\n\tif pc.server == nil || *pc.server == \"\" {\n\t\treturn errors.New(\"no server specified\")\n\t}\n\tif pc.channel == nil || *pc.channel == \"\" {\n\t\treturn errors.New(\"no channel specified\")\n\t}\n\n\tserver := *pc.server\n\tchannel := *pc.channel\n\n\treq := discovery.NewRequest().OfChannel(channel).AddConfigQuery()\n\tres, err := pc.stub.Send(server, conf, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn pc.parser.ParseResponse(channel, res)\n}\n\n// ConfigResponseParser parses config responses\ntype ConfigResponseParser struct {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/cmd/config.go#L30-L66","documentation":"ConfigCmd.Execute validates the discovery CLI command's inputs before building a config query. The --server flag (address of the discovery service / peer) is nil or an empty string, so there is no endpoint to send the request to. The library fails fast rather than attempting a connection with an empty address.","triggerScenarios":"Running a discovery config command without specifying the server, or calling ConfigCmd.Execute with pc.server left nil/unset.","commonSituations":"Omitting --server (or -S) on the discovery CLI; programmatically constructing ConfigCmd without calling SetServer; config wiring that never propagated the peer address.","solutions":["Pass --server <host:port> (the discovery service address) on the command line","Programmatically call the server setter (e.g. configCmd.SetServer(\"peer0:7051\")) before Execute","Verify your wrapper scripts/env include the discovery server address"],"exampleFix":"// before\nconfigCmd := discovery.NewConfigCmd()\nconfigCmd.SetChannel(\"mychannel\")\n// after\nconfigCmd := discovery.NewConfigCmd()\nconfigCmd.SetServer(\"peer0.example.com:7051\")\nconfigCmd.SetChannel(\"mychannel\")","handlingStrategy":"validation","validationCode":"if server == \"\" {\n    return errors.New(\"--server is required: pass the discovery service address host:port\")\n}\nif channel == \"\" {\n    return errors.New(\"--channel is required\")\n}","typeGuard":"func configCmdReady(pc *discovery.ConfigCmd, server, channel *string) bool {\n    return server != nil && *server != \"\" && channel != nil && *channel != \"\"\n}","tryCatchPattern":"if err := configCmd.Execute(conf); err != nil {\n    if strings.Contains(err.Error(), \"no server specified\") {\n        return fmt.Errorf(\"usage: discovery config --server host:port --channel name: %w\", err)\n    }\n    return err\n}","preventionTips":["Always pass --server/--channel together in discovery CLI invocations","Wrap the command in a script that asserts required flags are set","Print usage help on argument-validation errors"],"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"}