hyperledger/fabric · error

error unmarshalling ChaincodeID

Error message

error unmarshalling ChaincodeID

What it means

Returned by protoutil.UnmarshalChaincodeID when proto.Unmarshal fails on the supplied bytes — they are not a validly encoded peer.ChaincodeID. Generic unmarshal wrapper; the input at fault is whatever bytes the caller extracted for the chaincode ID field.

Source

Thrown at protoutil/unmarshalers.go:68

// UnmarshalEnvelope unmarshals bytes to a Envelope
func UnmarshalEnvelope(encoded []byte) (*common.Envelope, error) {
	envelope := &common.Envelope{}
	err := proto.Unmarshal(encoded, envelope)
	return envelope, errors.Wrap(err, "error unmarshalling Envelope")
}

// UnmarshalChannelHeader unmarshals bytes to a ChannelHeader
func UnmarshalChannelHeader(bytes []byte) (*common.ChannelHeader, error) {
	chdr := &common.ChannelHeader{}
	err := proto.Unmarshal(bytes, chdr)
	return chdr, errors.Wrap(err, "error unmarshalling ChannelHeader")
}

// UnmarshalChaincodeID unmarshals bytes to a ChaincodeID
func UnmarshalChaincodeID(bytes []byte) (*peer.ChaincodeID, error) {
	ccid := &peer.ChaincodeID{}
	err := proto.Unmarshal(bytes, ccid)
	return ccid, errors.Wrap(err, "error unmarshalling ChaincodeID")
}

// UnmarshalSignatureHeader unmarshals bytes to a SignatureHeader
func UnmarshalSignatureHeader(bytes []byte) (*common.SignatureHeader, error) {
	sh := &common.SignatureHeader{}
	err := proto.Unmarshal(bytes, sh)
	return sh, errors.Wrap(err, "error unmarshalling SignatureHeader")
}

// UnmarshalIdentifierHeader unmarshals bytes to an IdentifierHeader
func UnmarshalIdentifierHeader(bytes []byte) (*common.IdentifierHeader, error) {
	ih := &common.IdentifierHeader{}
	err := proto.Unmarshal(bytes, ih)
	return ih, errors.Wrap(err, "error unmarshalling IdentifierHeader")
}

func UnmarshalSerializedIdentity(bytes []byte) (*msp.SerializedIdentity, error) {
	sid := &msp.SerializedIdentity{}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Fix the producer of the ChaincodeID bytes
  2. Verify the message type matches before unmarshalling
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at protoutil/unmarshalers.go:68 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/6c588aa33863a9f4. Report an issue: GitHub.