{"record":{"id":"b2d0428c501c67fe","repo":"hyperledger/fabric","slug":"must-supply-channel-id-b2d042","errorCode":null,"errorMessage":"Must supply channel ID","messagePattern":"Must supply channel ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/channel/getinfo.go","lineNumber":87,"sourceCode":"\t}\n\n\tif proposalResp.Response == nil || proposalResp.Response.Status != http.StatusOK {\n\t\treturn nil, errors.Errorf(\"received bad response, status %d: %s\", proposalResp.Response.Status, proposalResp.Response.Message)\n\t}\n\n\tblockChainInfo := &cb.BlockchainInfo{}\n\terr = proto.Unmarshal(proposalResp.Response.Payload, blockChainInfo)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"cannot read qscc response\")\n\t}\n\n\treturn blockChainInfo, nil\n}\n\nfunc getinfo(cmd *cobra.Command, cf *ChannelCmdFactory) error {\n\t// the global chainID filled by the \"-c\" command\n\tif channelID == common.UndefinedParamValue {\n\t\treturn errors.New(\"Must supply channel ID\")\n\t}\n\t// Parsing of the command line is done so silence cmd usage\n\tcmd.SilenceUsage = true\n\n\tvar err error\n\tif cf == nil {\n\t\tcf, err = InitCmdFactory(EndorserRequired, PeerDeliverNotRequired, OrdererNotRequired)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tclient := &endorserClient{cf}\n\n\tblockChainInfo, err := client.getBlockChainInfo()\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/channel/getinfo.go#L69-L105","documentation":"getinfo validates that the global channelID (set via the -c/--channelID flag) is not the undefined empty value. If the user did not supply a channel ID, the command aborts early with this message. It is a straightforward CLI argument validation error thrown before any network activity.","triggerScenarios":"Running `peer channel getinfo` without the `-c <channelID>` flag (or with an empty -c value).","commonSituations":"Copying an example command that omitted -c; scripting with an unset shell variable for the channel name; typos like -channelID instead of --channelID.","solutions":["Rerun with the channel ID: `peer channel getinfo -c mychannel`.","In scripts, verify the CHANNEL_NAME variable is set before invoking the command.","Check `peer channel getinfo --help` for exact flag spelling."],"exampleFix":"// before\npeer channel getinfo\n// after\npeer channel getinfo -c mychannel","handlingStrategy":"validation","validationCode":"// bash\n: \"${CHANNEL_NAME:?set -c / CHANNEL_NAME before running}\"\npeer channel getinfo -c \"$CHANNEL_NAME\"","typeGuard":null,"tryCatchPattern":"// bash\nif ! out=$(peer channel getinfo -c \"$CHAN\" 2>&1); then\n  case \"$out\" in *\"Must supply channel ID\"*) echo \"add -c flag\";; esac\nfi","preventionTips":["Always include -c <channelID> in getinfo invocations and templates.","Fail fast in scripts with : \"${CHANNEL_NAME:?}\" before CLI calls.","Wrap CLI calls in helper functions that assert required flags."],"tags":["hyperledger-fabric","cli","missing-argument"],"backgroundTag":"missing-required-flag","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"}