{"record":{"id":"52bc7c1a23e04115","repo":"hyperledger/fabric","slug":"cannot-rollback-any-channel-because-the-peer-conta","errorCode":null,"errorMessage":"cannot rollback any channel because the peer contains channel(s) %s that were bootstrapped from snapshot","messagePattern":"cannot rollback any channel because the peer contains channel\\(s\\) (.+?) that were bootstrapped from snapshot","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/ledger/kvledger/rollback.go","lineNumber":31,"sourceCode":")\n\n// RollbackKVLedger rollbacks a ledger to a specified block number\nfunc RollbackKVLedger(rootFSPath, ledgerID string, blockNum uint64) error {\n\tfileLockPath := fileLockPath(rootFSPath)\n\tfileLock := leveldbhelper.NewFileLock(fileLockPath)\n\tif err := fileLock.Lock(); err != nil {\n\t\treturn errors.Wrap(err, \"as another peer node command is executing,\"+\n\t\t\t\" wait for that command to complete its execution or terminate it before retrying\")\n\t}\n\tdefer fileLock.Unlock()\n\n\tblockstorePath := BlockStorePath(rootFSPath)\n\tledgerIDs, err := blkstorage.GetLedgersBootstrappedFromSnapshot(blockstorePath)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"error while checking if any ledger has been bootstrapped from snapshot\")\n\t}\n\tif len(ledgerIDs) > 0 {\n\t\treturn errors.Errorf(\"cannot rollback any channel because the peer contains channel(s) %s that were bootstrapped from snapshot\", ledgerIDs)\n\t}\n\n\tif err := blkstorage.ValidateRollbackParams(blockstorePath, ledgerID, blockNum); err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Infof(\"Dropping databases\")\n\tif err := dropDBs(rootFSPath); err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Info(\"Rolling back ledger store\")\n\tindexConfig := &blkstorage.IndexConfig{AttrsToIndex: attrsToIndex}\n\tif err := blkstorage.Rollback(blockstorePath, ledgerID, blockNum, indexConfig); err != nil {\n\t\treturn err\n\t}\n\tlogger.Infof(\"The channel [%s] has been successfully rolled back to the block number [%d]\", ledgerID, blockNum)\n\treturn nil","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/ledger/kvledger/rollback.go#L13-L49","documentation":"RollbackKVLedger refuses to roll back when the peer contains any ledger bootstrapped from a snapshot. Rollback rewinds to an earlier block number, which is meaningless and unsafe for snapshot-bootstrapped channels (their earliest local data is the snapshot point, not genesis). The error names the affected channels.","triggerScenarios":"Running 'peer node rollback' targeting (or while the peer hosts) channels joined from a snapshot, detected via blkstorage.GetLedgersBootstrappedFromSnapshot before parameter validation.","commonSituations":"Rolling back after a fork on a peer where some channels were snapshot-joined; applying a rollback runbook written for genesis-bootstrapped peers.","solutions":["Do not roll back channels bootstrapped from a snapshot; the command is blocked by design.","To recover a snapshot-joined channel, rejoin it from a newer snapshot taken before the bad state.","For genesis-bootstrapped channels on the same peer, temporarily migrate the snapshot channels to another peer, or accept the restriction.","Always verify which channels are snapshot-bootstrapped before planning rollback procedures."],"exampleFix":"// before\npeer node rollback --channelID mychannel --blockNumber 100\n// Error: cannot rollback any channel because the peer contains channel(s) [mychannel] that were bootstrapped from snapshot\n// after: rejoin channel from an earlier snapshot\npeer node channel join --snapshot-file /var/snapshots/before-fork.snapshot","handlingStrategy":"validation","validationCode":"// pre-check before planning a rollback\nids, err := blkstorage.GetLedgersBootstrappedFromSnapshot(blkstorage.BlockStorePath(rootFSPath))\nif err != nil {\n\treturn err\n}\nif len(ids) > 0 {\n\treturn fmt.Errorf(\"rollback unsupported for snapshot-bootstrapped channels: %v\", ids)\n}","typeGuard":null,"tryCatchPattern":"if err := ledger.RollbackKVLedger(rootFSPath, ledgerID, blockNum); err != nil {\n\tif strings.Contains(err.Error(), \"bootstrapped from snapshot\") {\n\t\treturn fmt.Errorf(\"recover via rejoin from an earlier snapshot: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Maintain a periodic snapshot schedule for snapshot-joined channels so recovery points exist","Check channel bootstrap type before including channels in rollback procedures","Do not mix genesis and snapshot recovery playbooks on the same peer","Validate rollback parameters (target blockNum exists) only for genesis-bootstrapped channels"],"tags":["hyperledger-fabric","snapshot","rollback","unsupported-operation"],"backgroundTag":"snapshot-bootstrap-unsupported","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"}