{"record":{"id":"a9379d5ded341ae5","repo":"hyperledger/fabric","slug":"must-supply-channel-id-a9379d","errorCode":null,"errorMessage":"Must supply channel ID","messagePattern":"Must supply channel ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/node/rollback.go","lineNumber":39,"sourceCode":"func rollbackCmd() *cobra.Command {\n\tnodeRollbackCmd.ResetFlags()\n\tflags := nodeRollbackCmd.Flags()\n\tflags.StringVarP(&channelID, \"channelID\", \"c\", common.UndefinedParamValue, \"Channel to rollback.\")\n\tflags.Uint64VarP(&blockNumber, \"blockNumber\", \"b\", 0, \"Block number to which the channel needs to be rolled back to.\")\n\n\treturn nodeRollbackCmd\n}\n\nvar nodeRollbackCmd = &cobra.Command{\n\tUse:   \"rollback\",\n\tShort: \"Rolls back a channel.\",\n\tLong: \"Rolls back a channel to a specified block number. When the command is executed, the peer must be offline.\" +\n\t\t\" When the peer starts after the rollback, it will receive blocks, which got removed during the rollback,\" +\n\t\t\" from an orderer or another peer to rebuild the block store and state database.\" +\n\t\t\" The command is not supported if the peer contains any channel that was bootstrapped from a snapshot.\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tif channelID == common.UndefinedParamValue {\n\t\t\treturn errors.New(\"Must supply channel ID\")\n\t\t}\n\n\t\tconfig := ledgerConfig()\n\t\treturn kvledger.RollbackKVLedger(config.RootFSPath, channelID, blockNumber)\n\t},\n}\n","sourceCodeStart":21,"sourceCodeEnd":46,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/node/rollback.go#L21-L46","documentation":"The `peer node rollback` command rolls a channel's ledger back to a given block number and requires both a channel ID and a target block number. If the channelID flag is not supplied, RunE returns this error instead of invoking kvledger.RollbackKVLedger.","triggerScenarios":"Running `peer node rollback` without --channelID / -c (even if --blockNumber is provided).","commonSituations":"Rolling back after a ledger corruption or fork and forgetting -c; automating rollback across peers where the channel variable is empty; flag typos in runbooks.","solutions":["Re-run with both flags: `peer node rollback -c <channelID> -b <blockNumber>` (peer offline).","Verify --channelID spelling and that the value is not empty in scripts.","Remember the peer must be offline and must not host snapshot-bootstrapped channels; validate preconditions before retrying."],"exampleFix":"// before\npeer node rollback --blockNumber 1000\n// after\npeer node rollback -c mychannel --blockNumber 1000","handlingStrategy":"validation","validationCode":"if [ -z \"$CHANNEL\" ] || [ -z \"$BLOCK\" ]; then echo \"usage: peer node rollback -c <channelID> -b <blockNumber>\" >&2; exit 1; fi\npeer node rollback -c \"$CHANNEL\" -b \"$BLOCK\"","typeGuard":null,"tryCatchPattern":"if err := runRollback(); err != nil && err.Error() == \"Must supply channel ID\" {\n    return fmt.Errorf(\"usage: peer node rollback -c <channelID> --blockNumber N\")\n}","preventionTips":["Always include both -c <channelID> and --blockNumber.","Confirm the peer is offline and not snapshot-bootstrapped before rolling back.","Record the target block number and channel in maintenance runbooks to avoid omissions."],"tags":["fabric","peer-cli","ledger-rollback"],"backgroundTag":"missing-channel-id","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"}