{"record":{"id":"cef71927df1f5a93","repo":"hyperledger/fabric","slug":"invalid-collection-name-s-names-can-only-consi","errorCode":null,"errorMessage":"invalid collection name '%s'. Names can only consist of alphanumerics, '_', and '-' and cannot begin with '_'","messagePattern":"invalid collection name '(.+?)'\\. Names can only consist of alphanumerics, '_', and '-' and cannot begin with '_'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/lifecycle/scc.go","lineNumber":805,"sourceCode":"\t\t\tcollConfigs[i] = collConfig\n\t\tdefault:\n\t\t\t// this should only occur if a developer has added a new\n\t\t\t// collection config type\n\t\t\treturn nil, errors.Errorf(\"collection config contains unexpected payload type: %T\", t)\n\t\t}\n\t}\n\treturn collConfigs, nil\n}\n\nfunc validateCollectionConfigs(collConfigs []*pb.StaticCollectionConfig, mspMgr msp.MSPManager) error {\n\tif len(collConfigs) == 0 {\n\t\treturn nil\n\t}\n\tcollNamesMap := map[string]struct{}{}\n\t// Process each collection config from a set of collection configs\n\tfor _, c := range collConfigs {\n\t\tif !collectionNameRegExp.MatchString(c.Name) {\n\t\t\treturn errors.Errorf(\"invalid collection name '%s'. Names can only consist of alphanumerics, '_', and '-' and cannot begin with '_'\",\n\t\t\t\tc.Name)\n\t\t}\n\t\t// Ensure that there are no duplicate collection names\n\t\tif _, ok := collNamesMap[c.Name]; ok {\n\t\t\treturn errors.Errorf(\"collection-name: %s -- found duplicate in collection configuration\",\n\t\t\t\tc.Name)\n\t\t}\n\t\tcollNamesMap[c.Name] = struct{}{}\n\t\t// Validate gossip related parameters present in the collection config\n\t\tif c.MaximumPeerCount < c.RequiredPeerCount {\n\t\t\treturn errors.Errorf(\"collection-name: %s -- maximum peer count (%d) cannot be less than the required peer count (%d)\",\n\t\t\t\tc.Name, c.MaximumPeerCount, c.RequiredPeerCount)\n\t\t}\n\t\tif c.RequiredPeerCount < 0 {\n\t\t\treturn errors.Errorf(\"collection-name: %s -- requiredPeerCount (%d) cannot be less than zero\",\n\t\t\t\tc.Name, c.RequiredPeerCount)\n\t\t}\n\t\tif err := validateCollectionConfigMemberOrgsPolicy(c, mspMgr); err != nil {","sourceCodeStart":787,"sourceCodeEnd":823,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/lifecycle/scc.go#L787-L823","documentation":"Returned by validateCollectionConfigs when a static collection's Name fails collectionNameRegExp — wrong characters or a leading underscore. It is the entry-level name check applied to every collection in the package before duplicate/peer-count checks run.","triggerScenarios":"Thrown at core/chaincode/lifecycle/scc.go:805 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the collection to match [A-Za-z0-9-]+ (no leading underscore)","Fix the collections config JSON used at approve/commit time"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}