hyperledger/fabric · error

error while trying to retrieve transaction info by TXID [%s]

Error message

error while trying to retrieve transaction info by TXID [%s]

What it means

Returned by blockIndex.getTxIDVal when the levelDB range-scan iterator over the TXID index cannot be created. The database itself errored (not merely a missing key), and the failing TXID is included in the wrapped message.

Source

Thrown at common/ledger/blkstorage/blockindex.go:253

		return false, errors.Wrapf(err, "error while trying to check the presence of TXID [%s]", txID)
	}
	return present, nil
}

func (index *blockIndex) getTxIDVal(txID string) (*TxIDIndexValue, uint64, error) {
	if !index.isAttributeIndexed(IndexableAttrTxID) {
		return nil, 0, errors.New("transaction IDs not maintained in index")
	}
	rangeScan := constructTxIDRangeScan(txID)
	itr, err := index.db.GetIterator(rangeScan.startKey, rangeScan.stopKey)
	if err != nil {
		return nil, 0, errors.WithMessagef(err, "error while trying to retrieve transaction info by TXID [%s]", txID)
	}
	defer itr.Release()

	present := itr.Next()
	if err := itr.Error(); err != nil {
		return nil, 0, errors.Wrapf(err, "error while trying to retrieve transaction info by TXID [%s]", txID)
	}
	if !present {
		return nil, 0, errors.Errorf("no such transaction ID [%s] in index", txID)
	}
	valBytes := itr.Value()
	if len(valBytes) == 0 {
		return nil, 0, errNilValue
	}
	val := &TxIDIndexValue{}
	if err := proto.Unmarshal(valBytes, val); err != nil {
		return nil, 0, errors.Wrapf(err, "unexpected error while unmarshalling bytes [%#v] into TxIDIndexValProto", valBytes)
	}
	blockNum, err := retrieveBlockNum(itr.Key(), len(rangeScan.startKey))
	if err != nil {
		return nil, 0, errors.WithMessage(err, "error while decoding block number from txID index key")
	}
	return val, blockNum, nil
}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Check peer logs for LevelDB/FS errors and repair the index directory
  2. Restart the peer to release locks; rebuild the index if corruption persists
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at common/ledger/blkstorage/blockindex.go:253 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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