{"record":{"id":"50aec8f5bfa51015","repo":"hyperledger/fabric","slug":"must-supply-channel-id-50aec8","errorCode":null,"errorMessage":"Must supply channel ID","messagePattern":"Must supply channel ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/node/unjoin.go","lineNumber":29,"sourceCode":"\n\tcoreconfig \"github.com/hyperledger/fabric/core/config\"\n\t\"github.com/hyperledger/fabric/core/ledger/kvledger\"\n\t\"github.com/hyperledger/fabric/core/transientstore\"\n\t\"github.com/hyperledger/fabric/internal/peer/common\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc unjoinCmd() *cobra.Command {\n\tvar channelID string\n\n\tcmd := &cobra.Command{\n\t\tUse:   \"unjoin\",\n\t\tShort: \"Unjoin the peer from a channel.\",\n\t\tLong:  \"Unjoin the peer from a channel.  When the command is executed, the peer must be offline.\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif channelID == common.UndefinedParamValue {\n\t\t\t\treturn errors.New(\"Must supply channel ID\")\n\t\t\t}\n\n\t\t\tif err := unjoinChannel(channelID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\tflags := cmd.Flags()\n\tflags.StringVarP(&channelID, \"channelID\", \"c\", common.UndefinedParamValue, \"Channel to unjoin.\")\n\n\treturn cmd\n}\n\n// unjoin the peer from a channel.\nfunc unjoinChannel(channelID string) error {\n\t// transient storage must be scrubbed prior to removing the kvledger for the channel.  Once the","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/node/unjoin.go#L11-L47","documentation":"Cobra RunE guard for 'peer channel unjoin': the --channelID flag (checked via common.UnundefinedChannelID) was empty, so the command cannot know which channel's local data to remove. The peer must also be offline when it runs.","triggerScenarios":"Thrown at internal/peer/node/unjoin.go:29 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply --channelID with the name of the channel to unjoin","Run the command with the peer process stopped"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}