hyperledger/fabric · error
invalid collection name '%s'. Names can only consist of alph
Error message
invalid collection name '%s'. Names can only consist of alphanumerics, '_', and '-' and cannot begin with '_'
What it means
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.
Source
Thrown at core/chaincode/lifecycle/scc.go:805
collConfigs[i] = collConfig
default:
// this should only occur if a developer has added a new
// collection config type
return nil, errors.Errorf("collection config contains unexpected payload type: %T", t)
}
}
return collConfigs, nil
}
func validateCollectionConfigs(collConfigs []*pb.StaticCollectionConfig, mspMgr msp.MSPManager) error {
if len(collConfigs) == 0 {
return nil
}
collNamesMap := map[string]struct{}{}
// Process each collection config from a set of collection configs
for _, c := range collConfigs {
if !collectionNameRegExp.MatchString(c.Name) {
return errors.Errorf("invalid collection name '%s'. Names can only consist of alphanumerics, '_', and '-' and cannot begin with '_'",
c.Name)
}
// Ensure that there are no duplicate collection names
if _, ok := collNamesMap[c.Name]; ok {
return errors.Errorf("collection-name: %s -- found duplicate in collection configuration",
c.Name)
}
collNamesMap[c.Name] = struct{}{}
// Validate gossip related parameters present in the collection config
if c.MaximumPeerCount < c.RequiredPeerCount {
return errors.Errorf("collection-name: %s -- maximum peer count (%d) cannot be less than the required peer count (%d)",
c.Name, c.MaximumPeerCount, c.RequiredPeerCount)
}
if c.RequiredPeerCount < 0 {
return errors.Errorf("collection-name: %s -- requiredPeerCount (%d) cannot be less than zero",
c.Name, c.RequiredPeerCount)
}
if err := validateCollectionConfigMemberOrgsPolicy(c, mspMgr); err != nil {View on GitHub (pinned to 2736b63f8f)
Solutions
- Rename the collection to match [A-Za-z0-9-]+ (no leading underscore)
- Fix the collections config JSON used at approve/commit time
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/chaincode/lifecycle/scc.go:805 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/cef71927df1f5a93.
Report an issue: GitHub.