hyperledger/fabric · error
error while unmarshalling bootstrappingSnapshotInfo
Error message
error while unmarshalling bootstrappingSnapshotInfo
What it means
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.
Source
Thrown at common/ledger/blkstorage/blockfile_helper.go:183
filePath := deriveBlockfilePath(rootDir, fileNum)
fileInfo, err := os.Lstat(filePath)
if err != nil {
panic(errors.Wrapf(err, "error retrieving file info for file number %d", fileNum))
}
return fileInfo
}
func loadBootstrappingSnapshotInfo(rootDir string) (*BootstrappingSnapshotInfo, error) {
bsiBytes, err := os.ReadFile(filepath.Join(rootDir, bootstrappingSnapshotInfoFile))
if os.IsNotExist(err) {
return nil, nil
}
if err != nil {
return nil, errors.Wrapf(err, "error while reading bootstrappingSnapshotInfo file")
}
bsi := &BootstrappingSnapshotInfo{}
if err := proto.Unmarshal(bsiBytes, bsi); err != nil {
return nil, errors.Wrapf(err, "error while unmarshalling bootstrappingSnapshotInfo")
}
return bsi, nil
}
func IsBootstrappedFromSnapshot(blockStorageDir, ledgerID string) (bool, error) {
ledgerDir := filepath.Join(blockStorageDir, ChainsDir, ledgerID)
_, err := os.Stat(filepath.Join(ledgerDir, bootstrappingSnapshotInfoFile))
if os.IsNotExist(err) {
return false, nil
}
if err != nil {
return false, errors.Wrapf(err, "failed to read bootstrappingSnapshotInfo file under blockstore directory %s", ledgerDir)
}
return true, nil
}
func GetLedgersBootstrappedFromSnapshot(blockStorageDir string) ([]string, error) {
chainsDir := filepath.Join(blockStorageDir, ChainsDir)View on GitHub (pinned to 2736b63f8f)
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
Example fix
// before: partial copy leaves truncated file // after: verify checksum before starting peer // sha256sum -c snapshot.manifest && cp -a snapshot/chains/mychannel/* ledgersData/chains/mychannel/
Defensive patterns
Strategy: validation
Validate before calling
data, err := os.ReadFile(filepath.Join(rootDir, "bootstrappingSnapshotInfo"))
if err == nil {
var probe BootstrappingSnapshotInfo
if err := proto.Unmarshal(data, &probe); err != nil {
return fmt.Errorf("snapshot info corrupted: %w", err)
}
} Try / catch
if err != nil && strings.Contains(err.Error(), "unmarshalling bootstrappingSnapshotInfo") {
return restoreLedgerFromSnapshot(ledgerID)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.
Related errors
- unexpected error while unmarshalling bytes [%#v] into fileLo
- error decoding varint with proto.Buffer
- error decoding raw bytes with proto.Buffer
- error marshalling proto message to write to the snapshot fil
- error marshalling proto message to write to the snapshot fil
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/6ddb56d93a1613b2.
Report an issue: GitHub.