{"record":{"id":"28dd64c475d38094","repo":"OpenNHP/opennhp","slug":"s-servers-d-name-q-exceeds-d-chars","errorCode":null,"errorMessage":"%s: [[Servers]][%d] Name %q exceeds %d chars","messagePattern":"(.+?): \\[\\[Servers\\]\\]\\[(.+?)\\] Name %q exceeds (.+?) chars","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nhp/common/clusterconfig/clusterconfig.go","lineNumber":155,"sourceCode":"\t}\n\n\tif len(clusters) == 0 {\n\t\treturn fmt.Errorf(\"%s: no [[Servers]] configured\", label)\n\t}\n\tfor i, c := range clusters {\n\t\tif c == nil {\n\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] is nil\", label, i)\n\t\t}\n\t\tif c.PubKeyBase64 == \"\" {\n\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] missing PubKeyBase64\", label, i)\n\t\t}\n\t\tif opts.RequireName {\n\t\t\tif c.Name == \"\" {\n\t\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] (%s) missing Name — clusters are referenced from resource.toml by Name\",\n\t\t\t\t\tlabel, i, c.PubKeyBase64)\n\t\t\t}\n\t\t\tif len(c.Name) > NameMaxLen {\n\t\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] Name %q exceeds %d chars\",\n\t\t\t\t\tlabel, i, c.Name, NameMaxLen)\n\t\t\t}\n\t\t\tif !clusterNameRegex.MatchString(c.Name) {\n\t\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] Name %q invalid — allowed chars: [a-zA-Z0-9._-]\",\n\t\t\t\t\tlabel, i, c.Name)\n\t\t\t}\n\t\t}\n\n\t\tlegacy := c.hasLegacyFields()\n\t\thasInstances := len(c.Instances) > 0\n\n\t\tswitch {\n\t\tcase legacy && hasInstances:\n\t\t\t// Both forms in one entry is almost certainly an\n\t\t\t// incomplete migration. Refuse to guess which one the\n\t\t\t// operator meant.\n\t\t\treturn fmt.Errorf(\"%s: [[Servers]][%d] (%s) sets both top-level Ip/Hostname/Port and [[Servers.Instances]]; \"+\n\t\t\t\t\"pick one form — top-level fields are deprecated, prefer Instances\",","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/nhp/common/clusterconfig/clusterconfig.go#L137-L173","documentation":"Cluster-config validation error raised inside Normalize when opts.RequireName is set and a [[Servers]] entry's Name exceeds NameMaxLen characters. Cluster names are the reference key used by resource.toml entries, and they also feed fixed-size protocol/log fields, so over-long names are rejected at load time with the offending index and value included.","triggerScenarios":"Thrown at nhp/common/clusterconfig/clusterconfig.go:155 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Shorten the Name in the [[Servers]] entry to the documented maximum","Choose a short cluster alias and keep long descriptions in comments or other fields"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e04ca5ff03222a699c24205cd4bf8fee9af7ffe","analyzedAt":"2026-09-07T15:44:59.941Z","contentChangedAt":"2026-09-07T15:44:59.941Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}