hyperledger/fabric · error

unexpected error while unmarshalling bytes [%#v] into TxIDIn

Error message

unexpected error while unmarshalling bytes [%#v] into TxIDIndexValProto

What it means

Returned by blockIndex.getTxIDVal when the raw value bytes retrieved from the TXID index cannot be proto-unmarshaled into TxIDIndexValue. It indicates index corruption or an on-disk format mismatch, and dumps the offending bytes for diagnosis.

Source

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

	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
}

func (index *blockIndex) getTXLocByBlockNumTranNum(blockNum uint64, tranNum uint64) (*fileLocPointer, error) {
	if !index.isAttributeIndexed(IndexableAttrBlockNumTranNum) {
		return nil, errors.New("<blockNumber, transactionNumber> tuple not maintained in index")
	}
	b, err := index.db.Get(constructBlockNumTranNumKey(blockNum, tranNum))
	if err != nil {
		return nil, err
	}
	if b == nil {
		return nil, errors.Errorf("no such blockNumber, transactionNumber <%d, %d> in index", blockNum, tranNum)

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Drop and rebuild the block index (deleteIndexEntries / re-sync on restart)
  2. Investigate disk-level corruption of the LevelDB index files
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at common/ledger/blkstorage/blockindex.go:264 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/d3cb7cd0680698ff. Report an issue: GitHub.