hyperledger/fabric · error
config ID illegal, cannot be longer than %d
Error message
config ID illegal, cannot be longer than %d
What it means
validateConfigID enforces a maximum identifier length (MaxLength, 250 characters). Config IDs longer than this limit are rejected to keep configuration paths bounded. The error includes the numeric limit.
Source
Thrown at common/configtx/validator.go:55
configMap map[string]comparable
configProto *cb.Config
namespace string
pm policies.Manager
}
// validateConfigID makes sure that the config element names (ie map key of
// ConfigGroup) comply with the following restrictions
// 1. Contain only ASCII alphanumerics, dots '.', dashes '-'
// 2. Are shorter than 250 characters.
// 3. Are not the strings "." or "..".
func validateConfigID(configID string) error {
re, _ := regexp.Compile(configAllowedChars)
// Length
if len(configID) <= 0 {
return errors.New("config ID illegal, cannot be empty")
}
if len(configID) > MaxLength {
return errors.Errorf("config ID illegal, cannot be longer than %d", MaxLength)
}
// Illegal name
if _, ok := illegalNames[configID]; ok {
return errors.Errorf("name '%s' for config ID is not allowed", configID)
}
// Illegal characters
matched := re.FindString(configID)
if len(matched) != len(configID) {
return errors.Errorf("config ID '%s' contains illegal characters", configID)
}
return nil
}
// ValidateChannelID makes sure that proposed channel IDs comply with the
// following restrictions:
// 1. Contain only lower case ASCII alphanumerics, dots '.', and dashes '-'
// 2. Are shorter than 250 characters.View on GitHub (pinned to 2736b63f8f)
Solutions
- Shorten the config ID to at most MaxLength (250) characters
- Use an abbreviated or hashed identifier and map it to the long name elsewhere
- Add a length check in any tooling that generates config keys
- Split deeply nested names into config group hierarchy instead of one long flat ID
Example fix
// before
id := orgName + "." + region + "." + serviceName // may exceed 250 chars
if len(id) > 250 {
return errors.New("config ID too long")
}
// after
id := abbreviate(orgName) + "." + region + "." + serviceName // <= 250 chars Defensive patterns
Strategy: validation
Validate before calling
const maxLen = 250
if len(configID) > maxLen {
return errors.Errorf("config ID %d chars exceeds max %d", len(configID), maxLen)
} Type guard
func validConfigIDLength(id string) bool {
return len(id) <= 250
} Try / catch
if err := configtx.ValidateChannelID(id); err != nil {
return fmt.Errorf("config ID rejected: %w", err)
} Prevention
- Cap name lengths in generators that compose IDs from multiple parts
- Use hashes/abbreviations for very long names
- Assert on generated config key lengths in CI
- Prefer hierarchy (nested groups) over long flat IDs
When it happens
Trigger: Using extremely long organization names, MSP or policy names as config IDs; programmatically concatenating names into keys exceeding 250 chars.
Common situations: Auto-generated config keys built from FQDNs or long org paths; copying long service names into config element IDs; nested group names assembled without length checks.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- config ID illegal, cannot be empty
- name '%s' for config ID is not allowed
- config ID '%s' contains illegal characters
- channel ID illegal, cannot be empty
- channel ID illegal, cannot be longer than %d
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/01d307b6f0571ebb.
Report an issue: GitHub.