{"record":{"id":"37b53ffbbb23ecbb","repo":"hyperledger/fabric","slug":"cannot-reset-channels-because-the-peer-contains-ch","errorCode":null,"errorMessage":"cannot reset channels because the peer contains channel(s) %s that were bootstrapped from snapshot","messagePattern":"cannot reset channels because the peer contains channel\\(s\\) (.+?) that were bootstrapped from snapshot","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/ledger/kvledger/reset.go","lineNumber":31,"sourceCode":")\n\n// ResetAllKVLedgers resets all ledger to the genesis block.\nfunc ResetAllKVLedgers(rootFSPath string) 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 err\n\t}\n\tif len(ledgerIDs) > 0 {\n\t\treturn errors.Errorf(\"cannot reset channels because the peer contains channel(s) %s that were bootstrapped from snapshot\", ledgerIDs)\n\t}\n\n\tlogger.Info(\"Resetting all channel ledgers to genesis block\")\n\tlogger.Infof(\"Ledger data folder from config = [%s]\", rootFSPath)\n\tif err := dropDBs(rootFSPath); err != nil {\n\t\treturn err\n\t}\n\tif err := resetBlockStorage(rootFSPath); err != nil {\n\t\treturn err\n\t}\n\tlogger.Info(\"All channel ledgers have been successfully reset to the genesis block\")\n\treturn nil\n}\n\n// LoadPreResetHeight returns the prereset height for the specified ledgers.\nfunc LoadPreResetHeight(rootFSPath string, ledgerIDs []string) (map[string]uint64, error) {\n\tblockstorePath := BlockStorePath(rootFSPath)\n\tlogger.Infof(\"Loading prereset height from path [%s]\", blockstorePath)","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/ledger/kvledger/reset.go#L13-L49","documentation":"ResetAllKVLedgers refuses to reset the peer when any ledger was bootstrapped from a snapshot. Reset restores channels to their genesis block, but snapshot-bootstrapped channels have no genesis block locally, so resetting would destroy them irrecoverably. The error lists the offending channel IDs.","triggerScenarios":"Running 'peer node reset' on a peer with channels joined via snapshot (detected by blkstorage.GetLedgersBootstrappedFromSnapshot returning a non-empty list).","commonSituations":"Trying to reclaim disk space or clear test data on a peer that was joined to a production channel via snapshot; blanket reset scripts applied across heterogeneous peers.","solutions":["Do not reset this peer; snapshot-joined channels cannot be restored afterward.","If you truly need to remove a snapshot-joined channel, rejoin from a newer snapshot afterward — never rely on reset.","Remove only genesis-bootstrapped channels' data or use a different peer for resettable test data.","Back up the entire ledgersData directory before attempting any destructive command."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// pre-check before reset\nids, err := blkstorage.GetLedgersBootstrappedFromSnapshot(blkstorage.BlockStorePath(rootFSPath))\nif err != nil {\n\treturn err\n}\nif len(ids) > 0 {\n\treturn fmt.Errorf(\"reset not allowed; snapshot-bootstrapped channels present: %v\", ids)\n}","typeGuard":null,"tryCatchPattern":"if err := ledger.ResetAllKVLedgers(rootFSPath); err != nil {\n\tif strings.Contains(err.Error(), \"bootstrapped from snapshot\") {\n\t\t// do not force; plan rejoin-from-snapshot for those channels\n\t\treturn fmt.Errorf(\"use snapshot rejoin instead of reset: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Record snapshot-joined channels in peer inventory before any destructive command","Never apply generic reset scripts to peers hosting snapshot-joined channels","Take a full file-level backup of ledgersData before reset attempts","Prefer per-channel removal over global reset"],"tags":["hyperledger-fabric","snapshot","reset","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"}