{"record":{"id":"45b824f728256fd2","repo":"hyperledger/fabric","slug":"setup-error-unsupported-msp-type-d","errorCode":null,"errorMessage":"Setup error: unsupported msp type %d","messagePattern":"Setup error: unsupported msp type (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/channelconfig/msp.go","lineNumber":71,"sourceCode":"\t\t\treturn nil, errors.WithMessage(err, \"creating the MSP manager failed\")\n\t\t}\n\n\t\t// add a cache layer on top\n\t\ttheMsp, err = cache.New(mspInst)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessage(err, \"creating the MSP cache failed\")\n\t\t}\n\tcase int32(msp.IDEMIX):\n\t\t// create the idemix msp instance\n\t\ttheMsp, err = msp.New(\n\t\t\t&msp.IdemixNewOpts{NewBaseOpts: msp.NewBaseOpts{Version: bh.version}},\n\t\t\tbh.bccsp,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessage(err, \"creating the MSP manager failed\")\n\t\t}\n\tdefault:\n\t\treturn nil, errors.New(fmt.Sprintf(\"Setup error: unsupported msp type %d\", mspConfig.Type))\n\t}\n\n\t// set it up\n\terr = theMsp.Setup(mspConfig)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"setting up the MSP manager failed\")\n\t}\n\n\t// add the MSP to the map of pending MSPs\n\tmspID, _ := theMsp.GetIdentifier()\n\n\texistingPendingMSPConfig, ok := bh.idMap[mspID]\n\tif ok && !proto.Equal(existingPendingMSPConfig.mspConfig, mspConfig) {\n\t\treturn nil, errors.New(fmt.Sprintf(\"Attempted to define two different versions of MSP: %s\", mspID))\n\t}\n\n\tif !ok {\n\t\tbh.idMap[mspID] = &pendingMSPConfig{","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/channelconfig/msp.go#L53-L89","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check mspConfig.Type — use fabprotos.MSPConfig Type = 0 (FABRIC) unless you intentionally use IDEMIX (1)","Regenerate the MSP config (cryptogen / configtxgen / fabca) so the correct provider type is embedded","If using IDEMIX, enable the required capabilities and MSP support in your build","Verify the MSP config bytes were not truncated or mis-decoded before ProposeMSP"],"exampleFix":"// before: wrong type in config\ncfg := &fab.MSPConfig{Type: 3, Config: mspBytes}\n// after: FABRIC provider (type 0)\ncfg := &fab.MSPConfig{Type: msp.FABRIC, Config: mspBytes}","handlingStrategy":"validation","validationCode":"if mspConfig.Type != int32(fabprotos.MSPConfig_FABRIC) && mspConfig.Type != int32(fabprotos.MSPConfig_IDEMIX) {\n    return fmt.Errorf(\"unsupported msp type %d; use FABRIC(0) or IDEMIX(1)\", mspConfig.Type)\n}","typeGuard":"func isSupportedMSPType(t int32) bool {\n    switch t {\n    case int32(fabprotos.MSPConfig_FABRIC), int32(fabprotos.MSPConfig_IDEMIX):\n        return true\n    }\n    return false\n}","tryCatchPattern":"mspCfg, err := ProposeMSP(bh, mspConfig)\nif err != nil && strings.Contains(err.Error(), \"unsupported msp type\") {\n    return fmt.Errorf(\"MSP type %d not supported; regenerate MSP config with FABRIC type: %w\", mspConfig.Type, err)\n}","preventionTips":["Always generate MSP config via cryptogen/fabca/configtxgen, not by hand","Confirm the MSP Type field is 0 (FABRIC) in decoded config","Enable IDEMIX support only if you deliberately use idemix MSPs","Decode and inspect MSP configs with configtxlator before channel creation"],"tags":["hyperledger-fabric","msp","config-validation"],"backgroundTag":"unsupported-msp-type","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}