hyperledger/fabric · error

BlockStore for %s does not exist. Aborting identifytxs

Error message

BlockStore for %s does not exist. Aborting identifytxs

What it means

IdentifyTxs needs to read blocks from the peer's block store for the ledger named in the diff records. It first checks blockStoreProvider.Exists for the ledger id; if no block store exists for that ledger id the tool aborts with this error.

Source

Thrown at internal/ledgerutil/identifytxs/identifytxs.go:81

	// Get recordsMap from json
	inputKeyMapWrapper, err := generateRecordsMap(records.DiffRecords, outputDirPath)
	if err != nil {
		return 0, 0, err
	}

	// Set up block store and block iterator in preparation for traversal
	blockStoreProvider, err := getBlockStoreProvider(fsPath)
	if err != nil {
		return 0, 0, err
	}
	defer blockStoreProvider.Close()

	blockStoreExists, err := blockStoreProvider.Exists(records.Ledgerid)
	if err != nil {
		return 0, 0, err
	}
	if !blockStoreExists {
		return 0, 0, errors.Errorf("BlockStore for %s does not exist. Aborting identifytxs", records.Ledgerid)
	}
	blockStore, err := blockStoreProvider.Open(records.Ledgerid)
	if err != nil {
		return 0, 0, err
	}

	// Identify relevant transactions and write to json
	firstBlock, lastBlock, err := findAndWriteTxs(blockStore, inputKeyMapWrapper)
	if err != nil {
		return 0, 0, err
	}

	return firstBlock, lastBlock, nil
}

// compKey represents a composite key which is simply a namespace and key pair
type compKey struct {
	namespace, collection, key string

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Run the tool against the peer filesystem that actually hosts the block store for the ledger named in the JSON
  2. Confirm the ledger id matches an existing channel on the peer (ledgerData/chains/<ledgerid>)
  3. Regenerate the diff JSON from the correct ledger so records.Ledgerid is right

Example fix

// before
ledgerutil identifytxs ./diff-from-channelA.json ./peerB-data
// after (channelA lives on peerA)
ledgerutil identifytxs ./diff-from-channelA.json ./peerA-data
Defensive patterns

Strategy: validation

Validate before calling

// Go: check the ledger's block store exists under the peer data dir before running
ledgerID := "mychannel"
if _, err := os.Stat(filepath.Join(peerDataDir, "ledgersData", "chains", "chains", ledgerID)); os.IsNotExist(err) {
    return fmt.Errorf("no block store for ledger %s under %s", ledgerID, peerDataDir)
}

Try / catch

if _, _, err := ledgerutil.IdentifyTxs(recPath, peerDataDir); err != nil {
    if strings.Contains(err.Error(), "BlockStore for") {
        return fmt.Errorf("run against the peer data directory that hosts this ledger: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Running identifytxs against a peer data directory that has no ledger with the id recorded in the diff JSON (records.Ledgerid) — e.g. wrong peer filesystem, dropped channel, or renamed ledger.

Common situations: Running the utility on a different peer than the one that owns the ledger; channel was purged from the peer; typo or differing ledger/channel id between the snapshot/compare output and the peer data.

Related errors


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