hyperledger/fabric · error

failed to read bootstrappingSnapshotInfo file under blocksto

Error message

failed to read bootstrappingSnapshotInfo file under blockstore directory %s

What it means

IsBootstrappedFromSnapshot stats bootstrappingSnapshotInfoFile under the ledger's dir; NotExist means false, but any other stat error is wrapped into this error and returned to callers like GetLedgersBootstrappedFromSnapshot. It signals the ledger dir or file is present but not statable.

Source

Thrown at common/ledger/blkstorage/blockfile_helper.go:195

	}
	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)
	ledgerIDs, err := fileutil.ListSubdirs(chainsDir)
	if err != nil {
		return nil, err
	}

	isFromSnapshot := false
	ledgersFromSnapshot := []string{}
	for _, ledgerID := range ledgerIDs {
		if isFromSnapshot, err = IsBootstrappedFromSnapshot(blockStorageDir, ledgerID); err != nil {
			return nil, err
		}
		if isFromSnapshot {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Fix permissions on the ledger directory (chown/chmod to the peer user)
  2. Remove stale/broken ledger directories that are partially deleted
  3. Check storage mount health and retry

Example fix

// before: calling with wrong storage root
// IsBootstrappedFromSnapshot("/wrong/path", ledgerID)
// after: use the peer's configured fileLedger/ledgersData root
// IsBootstrappedFromSnapshot("/var/hyperledger/production/ledgersData/chains", ledgerID)
Defensive patterns

Strategy: validation

Validate before calling

dir := filepath.Join(blockStorageDir, "chains", ledgerID)
if fi, err := os.Stat(filepath.Join(dir, "bootstrappingSnapshotInfo")); err != nil && !os.IsNotExist(err) {
    return fmt.Errorf("cannot inspect ledger dir %s: %w", dir, err)
}

Type guard

func ledgerInspectable(blockStorageDir, ledgerID string) bool {
    _, err := os.Stat(filepath.Join(blockStorageDir, "chains", ledgerID, "bootstrappingSnapshotInfo"))
    return err == nil || os.IsNotExist(err)
}

Try / catch

ok, err := IsBootstrappedFromSnapshot(dir, ledgerID)
if err != nil {
    logger.Warnf("snapshot check failed for %s: %v", ledgerID, err)
    ok = false
}

Prevention

When it happens

Trigger: os.Stat fails with a non-NotExist error (permission denied, I/O error, symlink loop) when checking whether a ledger was bootstrapped from a snapshot.

Common situations: Directory listing tools calling GetLedgersBootstrappedFromSnapshot against a ledger dir with restrictive permissions; storage device errors; partially removed ledger directories.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/3c6b893bd7069f47. Report an issue: GitHub.