{"record":{"id":"6ddb56d93a1613b2","repo":"hyperledger/fabric","slug":"error-while-unmarshalling-bootstrappingsnapshotinf","errorCode":null,"errorMessage":"error while unmarshalling bootstrappingSnapshotInfo","messagePattern":"error while unmarshalling bootstrappingSnapshotInfo","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/ledger/blkstorage/blockfile_helper.go","lineNumber":183,"sourceCode":"\tfilePath := deriveBlockfilePath(rootDir, fileNum)\n\tfileInfo, err := os.Lstat(filePath)\n\tif err != nil {\n\t\tpanic(errors.Wrapf(err, \"error retrieving file info for file number %d\", fileNum))\n\t}\n\treturn fileInfo\n}\n\nfunc loadBootstrappingSnapshotInfo(rootDir string) (*BootstrappingSnapshotInfo, error) {\n\tbsiBytes, err := os.ReadFile(filepath.Join(rootDir, bootstrappingSnapshotInfoFile))\n\tif os.IsNotExist(err) {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error while reading bootstrappingSnapshotInfo file\")\n\t}\n\tbsi := &BootstrappingSnapshotInfo{}\n\tif err := proto.Unmarshal(bsiBytes, bsi); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error while unmarshalling bootstrappingSnapshotInfo\")\n\t}\n\treturn bsi, nil\n}\n\nfunc IsBootstrappedFromSnapshot(blockStorageDir, ledgerID string) (bool, error) {\n\tledgerDir := filepath.Join(blockStorageDir, ChainsDir, ledgerID)\n\t_, err := os.Stat(filepath.Join(ledgerDir, bootstrappingSnapshotInfoFile))\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"failed to read bootstrappingSnapshotInfo file under blockstore directory %s\", ledgerDir)\n\t}\n\treturn true, nil\n}\n\nfunc GetLedgersBootstrappedFromSnapshot(blockStorageDir string) ([]string, error) {\n\tchainsDir := filepath.Join(blockStorageDir, ChainsDir)","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/ledger/blkstorage/blockfile_helper.go#L165-L201","documentation":"This error wraps a proto.Unmarshal failure on the bytes of bootstrappingSnapshotInfoFile. The file exists but its contents are not a valid BootstrappingSnapshotInfo protobuf message, indicating corruption or an incompatible format.","triggerScenarios":"proto.Unmarshal(bsiBytes, bsi) fails because the bootstrappingSnapshotInfo file is truncated, empty-but-nonzero, hand-edited, or written by an incompatible Fabric version during newBlockfileMgr startup.","commonSituations":"Snapshot restore interrupted mid-copy leaving a truncated file; manual edits to ledger data; downgrade to a Fabric version with a different snapshot-info format.","solutions":["Re-restore the ledger from a valid snapshot (delete the corrupted dir and restore again)","If the ledger was created normally (not from a snapshot), delete the bogus bootstrappingSnapshotInfo file so load returns nil (not bootstrapped)","Verify Fabric peer version matches the version that produced the snapshot"],"exampleFix":"// before: partial copy leaves truncated file\n// after: verify checksum before starting peer\n// sha256sum -c snapshot.manifest && cp -a snapshot/chains/mychannel/* ledgersData/chains/mychannel/","handlingStrategy":"validation","validationCode":"data, err := os.ReadFile(filepath.Join(rootDir, \"bootstrappingSnapshotInfo\"))\nif err == nil {\n    var probe BootstrappingSnapshotInfo\n    if err := proto.Unmarshal(data, &probe); err != nil {\n        return fmt.Errorf(\"snapshot info corrupted: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unmarshalling bootstrappingSnapshotInfo\") {\n    return restoreLedgerFromSnapshot(ledgerID)\n}","preventionTips":["Verify file sizes/checksums from the snapshot manifest before restore","Don't downgrade peers below the version that wrote the snapshot","Keep snapshots taken at consistent, peer-stopped states"],"tags":["corruption","protobuf","snapshot"],"backgroundTag":"protobuf-unmarshal-failed","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"}