{"record":{"id":"01d307b6f0571ebb","repo":"hyperledger/fabric","slug":"config-id-illegal-cannot-be-longer-than-d","errorCode":null,"errorMessage":"config ID illegal, cannot be longer than %d","messagePattern":"config ID illegal, cannot be longer than (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/configtx/validator.go","lineNumber":55,"sourceCode":"\tconfigMap   map[string]comparable\n\tconfigProto *cb.Config\n\tnamespace   string\n\tpm          policies.Manager\n}\n\n// validateConfigID makes sure that the config element names (ie map key of\n// ConfigGroup) comply with the following restrictions\n//  1. Contain only ASCII alphanumerics, dots '.', dashes '-'\n//  2. Are shorter than 250 characters.\n//  3. Are not the strings \".\" or \"..\".\nfunc validateConfigID(configID string) error {\n\tre, _ := regexp.Compile(configAllowedChars)\n\t// Length\n\tif len(configID) <= 0 {\n\t\treturn errors.New(\"config ID illegal, cannot be empty\")\n\t}\n\tif len(configID) > MaxLength {\n\t\treturn errors.Errorf(\"config ID illegal, cannot be longer than %d\", MaxLength)\n\t}\n\t// Illegal name\n\tif _, ok := illegalNames[configID]; ok {\n\t\treturn errors.Errorf(\"name '%s' for config ID is not allowed\", configID)\n\t}\n\t// Illegal characters\n\tmatched := re.FindString(configID)\n\tif len(matched) != len(configID) {\n\t\treturn errors.Errorf(\"config ID '%s' contains illegal characters\", configID)\n\t}\n\n\treturn nil\n}\n\n// ValidateChannelID makes sure that proposed channel IDs comply with the\n// following restrictions:\n//  1. Contain only lower case ASCII alphanumerics, dots '.', and dashes '-'\n//  2. Are shorter than 250 characters.","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/configtx/validator.go#L37-L73","documentation":"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.","triggerScenarios":"Using extremely long organization names, MSP or policy names as config IDs; programmatically concatenating names into keys exceeding 250 chars.","commonSituations":"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.","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"],"exampleFix":"// before\nid := orgName + \".\" + region + \".\" + serviceName // may exceed 250 chars\nif len(id) > 250 {\n    return errors.New(\"config ID too long\")\n}\n// after\nid := abbreviate(orgName) + \".\" + region + \".\" + serviceName // <= 250 chars","handlingStrategy":"validation","validationCode":"const maxLen = 250\nif len(configID) > maxLen {\n    return errors.Errorf(\"config ID %d chars exceeds max %d\", len(configID), maxLen)\n}","typeGuard":"func validConfigIDLength(id string) bool {\n    return len(id) <= 250\n}","tryCatchPattern":"if err := configtx.ValidateChannelID(id); err != nil {\n    return fmt.Errorf(\"config ID rejected: %w\", err)\n}","preventionTips":["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"],"tags":["go","fabric","config","validation","naming"],"backgroundTag":"invalid-config-value","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"}