{"record":{"id":"50152aae1fcb834d","repo":"hyperledger/fabric","slug":"channel-name-must-be-specified","errorCode":null,"errorMessage":"channel name must be specified","messagePattern":"channel name must be specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/querycommitted.go","lineNumber":213,"sourceCode":"\torgs := []string{}\n\tapproved := qcdr.GetApprovals()\n\tfor org := range approved {\n\t\torgs = append(orgs, org)\n\t}\n\tsort.Strings(orgs)\n\n\tapprovals := \"\"\n\tfor _, org := range orgs {\n\t\tapprovals += fmt.Sprintf(\"%s: %t, \", org, approved[org])\n\t}\n\tapprovals = strings.TrimSuffix(approvals, \", \")\n\n\tfmt.Fprintf(c.Writer, \", Approvals: [%s]\\n\", approvals)\n}\n\nfunc (c *CommittedQuerier) validateInput() error {\n\tif c.Input.ChannelID == \"\" {\n\t\treturn errors.New(\"channel name must be specified\")\n\t}\n\n\treturn nil\n}\n\nfunc (c *CommittedQuerier) createProposal() (*pb.Proposal, error) {\n\tvar function string\n\tvar args proto.Message\n\n\tif c.Input.Name != \"\" {\n\t\tfunction = \"QueryChaincodeDefinition\"\n\t\targs = &lb.QueryChaincodeDefinitionArgs{\n\t\t\tName: c.Input.Name,\n\t\t}\n\t} else {\n\t\tfunction = \"QueryChaincodeDefinitions\"\n\t\targs = &lb.QueryChaincodeDefinitionsArgs{}\n\t}","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/querycommitted.go#L195-L231","documentation":"validateInput rejects the query before any network call when the --channelID flag is empty. A committed-definition query is channel-scoped, so a channel name is mandatory. This is a client-side preflight error, thrown by the CLI itself.","triggerScenarios":"Running 'peer lifecycle chaincode querycommitted' without --channelID (or with an empty value, e.g. from an unset shell variable).","commonSituations":"Scripting the CLI with CHANNEL_ID unset/empty; forgetting the flag in CI pipelines; typo'd flag name so it never binds.","solutions":["Pass --channelID <channel-name> explicitly","Verify the variable feeding the flag is non-empty in scripts (e.g. ${CHANNEL_ID:?unset})","Check flag spelling; --channelID is case-sensitive","Use --outputFormat json if needed for scripts once the flag is fixed"],"exampleFix":"// before\npeer lifecycle chaincode querycommitted --name mycc\n// error: channel name must be specified\n// after\npeer lifecycle chaincode querycommitted --channelID mychannel --name mycc","handlingStrategy":"validation","validationCode":"channelID := os.Getenv(\"CHANNEL_ID\")\nif channelID == \"\" {\n    return fmt.Errorf(\"--channelID is required: set CHANNEL_ID\")\n}\nargs = append(args, \"--channelID\", channelID)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --channelID explicitly in scripts","Fail fast on unset env vars (${CHANNEL_ID:?})","Validate CLI args in CI before invoking peer commands"],"tags":["fabric","cli","validation","missing-flag"],"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"}