hyperledger/fabric · error

inconsistent ccid info (%s/%s)

Error message

inconsistent ccid info (%s/%s)

What it means

The chaincode name in the transaction's header extension (ccID) does not match the ChaincodeId.Name embedded in the chaincode action's response payload (respPayload.ChaincodeId.Name). Fabric throws this because a mismatch indicates the action was not produced by the chaincode named in the proposal header — a tampering or corruption signal.

Source

Thrown at core/committer/txvalidator/v20/plugindispatcher/dispatcher.go:148

		return peer.TxValidationCode_INVALID_OTHER_REASON, errors.New("nil ChaincodeId in header extension")
	}

	if respPayload.ChaincodeId == nil {
		return peer.TxValidationCode_INVALID_OTHER_REASON, errors.New("nil ChaincodeId in ChaincodeAction")
	}

	// get name and version of the cc we invoked
	ccID := hdrExt.ChaincodeId.Name
	ccVer := respPayload.ChaincodeId.Version

	// sanity check on ccID
	if ccID == "" {
		err = errors.New("invalid chaincode ID")
		logger.Errorf("%+v", err)
		return peer.TxValidationCode_INVALID_CHAINCODE, err
	}
	if ccID != respPayload.ChaincodeId.Name {
		err = errors.Errorf("inconsistent ccid info (%s/%s)", ccID, respPayload.ChaincodeId.Name)
		logger.Errorf("%+v", err)
		return peer.TxValidationCode_INVALID_CHAINCODE, err
	}
	// sanity check on ccver
	if ccVer == "" {
		err = errors.New("invalid chaincode version")
		logger.Errorf("%+v", err)
		return peer.TxValidationCode_INVALID_CHAINCODE, err
	}

	wrNamespace := map[string]bool{}
	wrNamespace[ccID] = true
	if respPayload.Events != nil {
		ccEvent := &peer.ChaincodeEvent{}
		if err = proto.Unmarshal(respPayload.Events, ccEvent); err != nil {
			return peer.TxValidationCode_INVALID_OTHER_REASON, errors.Wrapf(err, "invalid chaincode event")
		}
		if ccEvent.ChaincodeId != ccID {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Rebuild the transaction envelope so the proposal header chaincodeId matches the chaincode that produced the response payload.
  2. Never reuse or mutate serialized ChaincodeAction payloads across transactions.
  3. Verify endorser/SDK versions align so ChaincodeId is serialized consistently.
  4. If seen on-chain from an untrusted client, treat the tx as invalid and investigate the submitter.

Example fix

// before: header names ccA, payload from ccB
hdrExt.ChaincodeId.Name = "ccA"; respPayload.ChaincodeId.Name = "ccB";
// after
hdrExt.ChaincodeId.Name = "mycc"; respPayload.ChaincodeId.Name = "mycc";
Defensive patterns

Strategy: validation

Validate before calling

if (hdrExt.chaincodeId.name !== respPayload.chaincodeId.name) { throw new Error(`ccid mismatch: ${hdrExt.chaincodeId.name} vs ${respPayload.chaincodeId.name}`); }

Type guard

function idsMatch(hdrExt, respPayload) { return !!hdrExt?.chaincodeId?.name && hdrExt.chaincodeId.name === respPayload?.chaincodeId?.name; }

Try / catch

try { validate(tx); } catch (err) { if (/inconsistent ccid info/.test(err.message)) { /* rebuild envelope; reject tx */ } else { throw err; } }

Prevention

When it happens

Trigger: During Dispatch validation, hdrExt.ChaincodeId.Name != respPayload.ChaincodeId.Name. Occurs when a response payload from one chaincode is spliced into an envelope whose header names a different chaincode, or when payloads are re-used/re-signed incorrectly.

Common situations: Custom transaction builders that copy respPayload between transactions; replay/mix-and-match attacks caught by the validator; misconfigured gateways/proxies rewriting envelopes; deserialization of legacy payloads with stale ChaincodeId fields.

Related errors


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