hyperledger/fabric · error

header type is not an endorser transaction

Error message

header type is not an endorser transaction

What it means

This error comes from Hyperledger Fabric's gossip private-data coordinator. getTxInfoFromTransactionBytes parses a transaction envelope to extract channel ID and TXID for private-data retrieval, and it only accepts endorser transactions. When the unmarshaled common.Header has a type other than HeaderType_ENDORSER_TRANSACTION (e.g. configuration records), the parse is aborted because private data semantics only exist for endorser transactions.

Source

Thrown at gossip/privdata/coordinator.go:439

		logger.Warningf("Invalid payload: %s", err)
		return nil, err
	}
	if payload.Header == nil {
		err := errors.New("payload header is nil")
		logger.Warningf("Invalid tx: %s", err)
		return nil, err
	}

	chdr, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)
	if err != nil {
		logger.Warningf("Invalid channel header: %s", err)
		return nil, err
	}
	txInfo.channelID = chdr.ChannelId
	txInfo.txID = chdr.TxId

	if chdr.Type != int32(common.HeaderType_ENDORSER_TRANSACTION) {
		err := errors.New("header type is not an endorser transaction")
		logger.Debugf("Invalid transaction type: %s", err)
		return nil, err
	}

	respPayload, err := protoutil.GetActionFromEnvelope(envBytes)
	if err != nil {
		logger.Warningf("Failed obtaining action from envelope: %s", err)
		return nil, err
	}

	tx, err := protoutil.UnmarshalTransaction(payload.Data)
	if err != nil {
		logger.Warningf("Invalid transaction in payload data for tx [%s]: %s", chdr.TxId, err)
		return nil, err
	}

	ccActionPayload, err := protoutil.UnmarshalChaincodeActionPayload(tx.Actions[0].Payload)
	if err != nil {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Verify the block you feed contains only regular endorser transactions; skip records where the block metadata tx-filter marks them invalid/non-tx.
  2. Run `peer node rebuild-dbs` or re-fetch the block from an orderer/peer if the ledger is corrupted.
  3. Ensure chaincode/config transactions are not pushed through the private-data coordinator path in custom code.
  4. Inspect the envelope with protoutil to confirm chdr.Type before calling private-data APIs.

Example fix

// before: feeding all block envelopes blindly
txInfo, err := getTxInfoFromTransactionBytes(txEnvBytes)

// after: guard by envelope type first
chdr, _ := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)
if chdr.Type != int32(common.HeaderType_ENDORSER_TRANSACTION) {
    continue // skip non-endorser records
}
txInfo, err := getTxInfoFromTransactionBytes(txEnvBytes)
Defensive patterns

Strategy: validation

Validate before calling

chdr, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)
if err != nil {
    return err
}
if chdr.Type != int32(common.HeaderType_ENDORSER_TRANSACTION) {
    return errors.Errorf("skip: header type %s is not ENDORSER_TRANSACTION", chdr.Type)
}

Type guard

func isEndorserTransaction(chdr *common.ChannelHeader) bool {
    return chdr != nil && chdr.Type == int32(common.HeaderType_ENDORSER_TRANSACTION)
}

Try / catch

txInfo, err := getTxInfoFromTransactionBytes(envBytes)
if err != nil {
    if strings.Contains(err.Error(), "header type is not an endorser transaction") {
        logger.Debugf("skipping non-endorser record")
        return nil // expected for config blocks
    }
    return err
}

Prevention

When it happens

Trigger: Feeding a non-endorser envelope (ConfigTx, CONFIG_UPDATE, PEER_RESOURCE_UPDATE) into the coordinator via getTxPvtdataInfoFromBlock — i.e. a block containing a non-transaction record, or corrupted ledger data where a non-tx record occupies a tx slot.

Common situations: Peers processing genesis/config blocks during bootstrap; corrupted ledger commit flags marking non-tx records as transactions; custom tooling that replays blocks or feeds envelopes through the coordinator incorrectly.

Related errors


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