hyperledger/fabric · error

the identity is a member of a different MSP (expected %s, go

Error message

the identity is a member of a different MSP (expected %s, got %s)

What it means

Raised when checking a MSPPrincipal_ROLE principal: the principal's MSPRole.MspIdentifier does not match the name of the MSP performing the check (msp.name). The identity may belong to a different organization's MSP than the one the principal references, so the principal can never be satisfied by this MSP and evaluation fails with the expected/got MSP identifiers in the message.

Source

Thrown at msp/mspimpl.go:501

// satisfiesPrincipalInternalPreV13 takes as arguments the identity and the principal.
// The function returns an error if one occurred.
// The function implements the behavior of an MSP up to and including v1.1.
func (msp *bccspmsp) satisfiesPrincipalInternalPreV13(id Identity, principal *m.MSPPrincipal) error {
	switch principal.PrincipalClassification {
	// in this case, we have to check whether the
	// identity has a role in the msp - member or admin
	case m.MSPPrincipal_ROLE:
		// Principal contains the msp role
		mspRole := &m.MSPRole{}
		err := proto.Unmarshal(principal.Principal, mspRole)
		if err != nil {
			return errors.Wrap(err, "could not unmarshal MSPRole from principal")
		}

		// at first, we check whether the MSP
		// identifier is the same as that of the identity
		if mspRole.MspIdentifier != msp.name {
			return errors.Errorf("the identity is a member of a different MSP (expected %s, got %s)", mspRole.MspIdentifier, id.GetMSPIdentifier())
		}

		// now we validate the different msp roles
		switch mspRole.Role {
		case m.MSPRole_MEMBER:
			// in the case of member, we simply check
			// whether this identity is valid for the MSP
			mspLogger.Debugf("Checking if identity satisfies MEMBER role for %s", msp.name)
			return msp.Validate(id)
		case m.MSPRole_ADMIN:
			mspLogger.Debugf("Checking if identity satisfies ADMIN role for %s", msp.name)
			// in the case of admin, we check that the
			// id is exactly one of our admins
			if msp.isInAdmins(id.(*identity)) {
				return nil
			}
			return errors.New("This identity is not an admin")
		case m.MSPRole_CLIENT:

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Compare the 'expected' and 'got' MSP IDs in the message and use an identity issued by the MSP the policy actually references.
  2. Fix the policy principal to reference the correct MspIdentifier (decode/encode with configtxlator if it's channel config).
  3. Verify channel configtx 'Organization' MSP IDs match the values used in policies and by fabric-ca when enrolling identities.
  4. Ensure the correct signing identity/wallet is being used by the client SDK for endorsement.

Example fix

// before: wrong org in policy principal
&MSPRole{MspIdentifier: "Org1MSP", Role: MSPRole_MEMBER} // identity is from Org2MSP

// after: policy principal matches the signer's MSP
&MSPRole{MspIdentifier: "Org2MSP", Role: MSPRole_MEMBER}
Defensive patterns

Strategy: validation

Validate before calling

// confirm signer MSP matches the policy principal before submitting
func mspMatches(principalMSP string, id fabric.Identity) bool {
	return principalMSP == id.GetMSPIdentifier()
}

Type guard

func sameMSP(principal *msp.MSPRole, id msp.Identity) bool {
	return principal.MspIdentifier == id.GetMSPIdentifier()
}

Try / catch

err := policy.Evaluate(id)
if err != nil && strings.Contains(err.Error(), "different MSP") {
	return fmt.Errorf("wrong identity for policy: need MSP %s, have %s — switch wallet identity", expected, got)
}

Prevention

When it happens

Trigger: A policy principal names MSP 'Org1MSP' but the identity being validated resolves to 'Org2MSP' (id.GetMSPIdentifier() differs), during endorsement checks, ACL enforcement, or identity/chaincode policy evaluation.

Common situations: Typo in the MSP ID inside a signature policy; policy written against the wrong organization; channel config where the MSP ID differs from what clients use (e.g. case mismatch); using an identity from the wrong org to sign/endorse; renamed organizations in configtx without updating policies.

Related errors


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