hyperledger/fabric · error

provided path %s is empty. Aborting verify

Error message

provided path %s is empty. Aborting verify

What it means

getBlockStorePath computes the block store path from the user-supplied filesystem path and checks it with fileutil.DirEmpty. If the directory is empty there are no blocks to verify, so verification aborts with this message naming the provided path.

Source

Thrown at internal/ledgerutil/verify/verify.go:174

func getFirstBlockNumberInLedger(info *common.BlockchainInfo) uint64 {
	snapshotInfo := info.GetBootstrappingSnapshotInfo()
	if snapshotInfo == nil {
		return uint64(0)
	}

	return snapshotInfo.GetLastBlockInSnapshot() + uint64(1)
}

// getBlockStoreProvider - Gets a default block store provider to access the peer's block store
func getBlockStoreProvider(fsPath string) (*blkstorage.BlockStoreProvider, error) {
	// Format path to block store
	blockStorePath := kvledger.BlockStorePath(filepath.Join(fsPath, ledgersDataDirName))
	isEmpty, err := fileutil.DirEmpty(blockStorePath)
	if err != nil {
		return nil, err
	}
	if isEmpty {
		return nil, errors.Errorf("provided path %s is empty. Aborting verify", fsPath)
	}
	// Default fields for block store provider
	conf := blkstorage.NewConf(blockStorePath, 0)
	indexConfig := &blkstorage.IndexConfig{
		AttrsToIndex: []blkstorage.IndexableAttr{
			blkstorage.IndexableAttrBlockNum,
			blkstorage.IndexableAttrBlockHash,
			blkstorage.IndexableAttrTxID,
			blkstorage.IndexableAttrBlockNumTranNum,
		},
	}
	metricsProvider := &disabled.Provider{}
	// Create new block store provider
	blockStoreProvider, err := blkstorage.NewProvider(conf, indexConfig, metricsProvider)
	if err != nil {
		return nil, err
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Point --path at the peer's actual data directory containing ledgersData (typically /var/hyperledger/production/ledgersData or a copy of it)
  2. Verify the directory is not empty with ls before running verification
  3. If the ledger was intentionally reset, re-sync the peer from orderers before verifying
  4. Fix volume mounts/persistent volume claims if data was expected but is missing

Example fix

// before
peer node verify-ledger --path /tmp/empty-dir
// after
peer node verify-ledger --path /var/hyperledger/production/ledgersData
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
function assertPathNonEmpty(p) {
  const st = fs.statSync(p);
  if (!st.isDirectory()) throw new Error(`${p} is not a directory`);
  if (fs.readdirSync(p).length === 0) throw new Error(`${p} is empty`);
}
assertPathNonEmpty('/var/hyperledger/production/ledgersData');

Prevention

When it happens

Trigger: Running VerifyLedger (peer node verify-ledger) with --path pointing at an empty directory — e.g. a fresh/empty data folder, or a path missing the ledgersData subtree contents.

Common situations: Typo in the path, verifying before the peer has ever committed blocks, pointing at a mounted-but-not-populated volume, or running against a peer whose data dir was just reset.

Related errors


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