{"record":{"id":"4b2ef11a63d10064","repo":"hyperledger/fabric","slug":"must-supply-channel-id","errorCode":null,"errorMessage":"must supply channel ID","messagePattern":"must supply channel ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/channel/create.go","lineNumber":233,"sourceCode":"\t\t\t\tcf.DeliverClient.Close()\n\t\t\t\tcf, err = InitCmdFactory(EndorserNotRequired, PeerDeliverNotRequired, OrdererRequired)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.WithMessage(err, \"failed connecting\")\n\t\t\t\t}\n\t\t\t\ttime.Sleep(200 * time.Millisecond)\n\t\t\t} else {\n\t\t\t\tcf.DeliverClient.Close()\n\t\t\t\treturn block, nil\n\t\t\t}\n\t\t}\n\t}\n}\n\n// deprecated\nfunc create(cmd *cobra.Command, args []string, 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\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(EndorserNotRequired, PeerDeliverNotRequired, OrdererRequired)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn executeCreate(cf)\n}\n","sourceCodeStart":215,"sourceCodeEnd":248,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/channel/create.go#L215-L248","documentation":"The (deprecated) create command validates that a channel ID was provided via the -c flag before doing anything. channelID defaults to the UndefinedParamValue sentinel, and if it is still unset the command cannot name the channel to create.","triggerScenarios":"Running `peer channel create` without -c/--channelID, or with -c \"\".","commonSituations":"Omitting the flag in scripts; -c holding the tx-config path by mistake; variable interpolation leaving the channel name empty; older tutorials mixing -c (channel) with -f ordering.","solutions":["Re-run with the channel name: peer channel create -c <channel-name> -f <tx> -o <orderer:port>","Ensure the channel name is non-empty and matches the one used in configtxgen -channelID.","In automation, assert the variable is set before invoking."],"exampleFix":"// before\npeer channel create -f ./channel-artifacts/mychannel.tx -o orderer:7050\n// after\npeer channel create -c mychannel -f ./channel-artifacts/mychannel.tx -o orderer:7050","handlingStrategy":"validation","validationCode":"if [ -z \"$CHANNEL_NAME\" ]; then echo \"error: -c channel ID required\" >&2; exit 1; fi\npeer channel create -c \"$CHANNEL_NAME\" -f mychannel.tx -o orderer:7050","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass -c with peer channel create.","Match -c to the channelID used in configtxgen.","Validate variables in automation before invoking."],"tags":["cli","fabric","channel","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"}