{"record":{"id":"6410be69cbdd5e9e","repo":"hyperledger/fabric","slug":"s-contains-illegal-characters","errorCode":null,"errorMessage":"'%s' contains illegal characters","messagePattern":"'(.+?)' contains illegal characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/configtx/validator.go","lineNumber":95,"sourceCode":"// with the following exception: '.' is converted to '_' in the CouchDB naming\n// This is to accommodate existing channel names with '.', especially in the\n// behave tests which rely on the dot notation for their sluggification.\n//\n// note: this function is a copy of the same in core/tx/endorser/parser.go\nfunc ValidateChannelID(channelID string) error {\n\tre, _ := regexp.Compile(ChannelAllowedChars)\n\t// Length\n\tif len(channelID) <= 0 {\n\t\treturn errors.Errorf(\"channel ID illegal, cannot be empty\")\n\t}\n\tif len(channelID) > MaxLength {\n\t\treturn errors.Errorf(\"channel ID illegal, cannot be longer than %d\", MaxLength)\n\t}\n\n\t// Illegal characters\n\tmatched := re.FindString(channelID)\n\tif len(matched) != len(channelID) {\n\t\treturn errors.Errorf(\"'%s' contains illegal characters\", channelID)\n\t}\n\n\treturn nil\n}\n\n// NewValidatorImpl constructs a new implementation of the Validator interface.\nfunc NewValidatorImpl(channelID string, config *cb.Config, namespace string, pm policies.Manager) (*ValidatorImpl, error) {\n\tif config == nil {\n\t\treturn nil, errors.Errorf(\"nil config parameter\")\n\t}\n\n\tif config.ChannelGroup == nil {\n\t\treturn nil, errors.Errorf(\"nil channel group\")\n\t}\n\n\tif err := ValidateChannelID(channelID); err != nil {\n\t\treturn nil, errors.Errorf(\"bad channel ID: %s\", err)\n\t}","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/configtx/validator.go#L77-L113","documentation":"Returned by ValidateChannelID when part of the channel ID matches the allowed-character regex but the whole string does not — i.e. the ID contains characters outside [a-zA-Z0-9.-_] (the length checks have already passed at this point).","triggerScenarios":"Thrown at common/configtx/validator.go:95 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the channel using only [a-z][A-Z][0-9]._- characters","Check for accidental whitespace or special characters copied into the channel ID"],"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"}