hyperledger/fabric · error

Setup error: unsupported msp type %d

Error message

Setup error: unsupported msp type %d

What it means

ProposeMSP switches on mspConfig.Type to decide which MSP provider implementation (e.g. FABRIC) to instantiate. If the type integer is not one of the supported providers, it returns 'Setup error: unsupported msp type %d'. This prevents setting up an MSP with an unknown provider type.

Source

Thrown at common/channelconfig/msp.go:71

			return nil, errors.WithMessage(err, "creating the MSP manager failed")
		}

		// add a cache layer on top
		theMsp, err = cache.New(mspInst)
		if err != nil {
			return nil, errors.WithMessage(err, "creating the MSP cache failed")
		}
	case int32(msp.IDEMIX):
		// create the idemix msp instance
		theMsp, err = msp.New(
			&msp.IdemixNewOpts{NewBaseOpts: msp.NewBaseOpts{Version: bh.version}},
			bh.bccsp,
		)
		if err != nil {
			return nil, errors.WithMessage(err, "creating the MSP manager failed")
		}
	default:
		return nil, errors.New(fmt.Sprintf("Setup error: unsupported msp type %d", mspConfig.Type))
	}

	// set it up
	err = theMsp.Setup(mspConfig)
	if err != nil {
		return nil, errors.WithMessage(err, "setting up the MSP manager failed")
	}

	// add the MSP to the map of pending MSPs
	mspID, _ := theMsp.GetIdentifier()

	existingPendingMSPConfig, ok := bh.idMap[mspID]
	if ok && !proto.Equal(existingPendingMSPConfig.mspConfig, mspConfig) {
		return nil, errors.New(fmt.Sprintf("Attempted to define two different versions of MSP: %s", mspID))
	}

	if !ok {
		bh.idMap[mspID] = &pendingMSPConfig{

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Check mspConfig.Type — use fabprotos.MSPConfig Type = 0 (FABRIC) unless you intentionally use IDEMIX (1)
  2. Regenerate the MSP config (cryptogen / configtxgen / fabca) so the correct provider type is embedded
  3. If using IDEMIX, enable the required capabilities and MSP support in your build
  4. Verify the MSP config bytes were not truncated or mis-decoded before ProposeMSP

Example fix

// before: wrong type in config
cfg := &fab.MSPConfig{Type: 3, Config: mspBytes}
// after: FABRIC provider (type 0)
cfg := &fab.MSPConfig{Type: msp.FABRIC, Config: mspBytes}
Defensive patterns

Strategy: validation

Validate before calling

if mspConfig.Type != int32(fabprotos.MSPConfig_FABRIC) && mspConfig.Type != int32(fabprotos.MSPConfig_IDEMIX) {
    return fmt.Errorf("unsupported msp type %d; use FABRIC(0) or IDEMIX(1)", mspConfig.Type)
}

Type guard

func isSupportedMSPType(t int32) bool {
    switch t {
    case int32(fabprotos.MSPConfig_FABRIC), int32(fabprotos.MSPConfig_IDEMIX):
        return true
    }
    return false
}

Try / catch

mspCfg, err := ProposeMSP(bh, mspConfig)
if err != nil && strings.Contains(err.Error(), "unsupported msp type") {
    return fmt.Errorf("MSP type %d not supported; regenerate MSP config with FABRIC type: %w", mspConfig.Type, err)
}

Prevention

When it happens

Trigger: Calling ProposeMSP (directly or via validateMSP during channel config validation) with an MSPConfig whose Type field is not a supported bccspmsp provider type (e.g. 0/UNKNOWN, IDEMIX not enabled, or arbitrary garbage value).

Common situations: Config transaction generated by tooling that sets MSP type incorrectly; IDEMIX MSP used without the required capability/support; corrupted MSP config in a channel creation or update transaction.

Related errors


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