{"record":{"id":"5ca0a99d730c2267","repo":"hyperledger/fabric","slug":"msp-for-org-s-has-empty-msp-id","errorCode":null,"errorMessage":"MSP for org %s has empty MSP ID","messagePattern":"MSP for org (.+?) has empty MSP ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/channelconfig/organization.go","lineNumber":93,"sourceCode":"\n// Validate returns whether the configuration is valid\nfunc (oc *OrganizationConfig) Validate() error {\n\treturn oc.validateMSP()\n}\n\nfunc (oc *OrganizationConfig) validateMSP() error {\n\tvar err error\n\n\tlogger.Debugf(\"Setting up MSP for org %s\", oc.name)\n\toc.msp, err = oc.mspConfigHandler.ProposeMSP(oc.protos.MSP)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toc.mspID, _ = oc.msp.GetIdentifier()\n\n\tif oc.mspID == \"\" {\n\t\treturn fmt.Errorf(\"MSP for org %s has empty MSP ID\", oc.name)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":75,"sourceCodeEnd":98,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/channelconfig/organization.go#L75-L98","documentation":"validateMSP builds the org's MSP from its config and requires a non-empty MSP identifier. If GetIdentifier returns an empty ID, the organization would be unidentifiable in the channel, so the config is rejected with this message naming the org.","triggerScenarios":"An org's FabricMSPConfig has an empty Name/ID field — e.g. an MSP definition generated or copied without setting the ID, or a config update that blanks the MSP name.","commonSituations":"Hand-editing crypto material or configtx.yaml and leaving the org MSP ID empty; generating MSP config programmatically and forgetting to set the Name field; copying a peer org template where the ID placeholder was never substituted.","solutions":["Set a non-empty ID/Name in the org's MSP definition (Organization.Name and MSPDir with matching MSP ID in configtx.yaml)","Verify the serialized FabricMSPConfig.Name is populated in the config value","Regenerate MSP material/config with cryptogen or fabric-ca and rebuild the channel config"],"exampleFix":"# before (configtx.yaml)\n- &Org1\n  Name: Org1\n  ID: \"\"\n# after\n- &Org1\n  Name: Org1\n  ID: Org1MSP","handlingStrategy":"validation","validationCode":"func mspIDPresent(mc *mb.FabricMSPConfig) error {\n\tif mc == nil || mc.Name == \"\" {\n\t\treturn fmt.Errorf(\"FabricMSPConfig.Name (MSP ID) must be non-empty\")\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"if err := oc.Validate(); err != nil {\n\tif strings.Contains(err.Error(), \"empty MSP ID\") {\n\t\treturn fmt.Errorf(\"set the org MSP ID in configtx.yaml (Organization.ID / MSP Name): %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Never leave Organization.ID empty in configtx.yaml; match it to the MSP Name in the crypto material","Regenerate MSP configs with cryptogen/fabric-ca rather than editing serialized protos by hand","Add a configtx.yaml pre-check that every org has a non-empty ID"],"tags":["hyperledger-fabric","msp","channelconfig","validation"],"backgroundTag":"empty-msp-id","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"}