{"record":{"id":"21ce4a1ad1d9e7ec","repo":"OpenNHP/opennhp","slug":"s-servers-d-name-q-invalid-allowed-char","errorCode":null,"errorMessage":"%s: [[Servers]][%d] Name %q invalid — allowed chars: [a-zA-Z0-9._-]","messagePattern":"(.+?): \\[\\[Servers\\]\\]\\[(.+?)\\] Name %q invalid — allowed chars: \\[a-zA-Z0-9\\._-\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nhp/common/clusterconfig/clusterconfig.go","lineNumber":159,"sourceCode":"\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\",\n\t\t\t\tlabel, i, c.PubKeyBase64)\n\t\tcase legacy && !hasInstances:\n\t\t\tdeprecate(\"%s: [[Servers]][%d] uses legacy single-server form (Hostname/Ip/Port at top level); \"+\n\t\t\t\t\"migrate to [[Servers.Instances]] in server.toml — auto-upgrading for now\",","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/nhp/common/clusterconfig/clusterconfig.go#L141-L177","documentation":"Cluster-config validation error from Normalize: the entry's Name contains characters outside [a-zA-Z0-9._-] (spaces, unicode, slashes, etc.). Because names are matched against references in resource.toml and used as map keys, any character that complicates exact matching is rejected up front.","triggerScenarios":"Thrown at nhp/common/clusterconfig/clusterconfig.go:159 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rewrite the Name using only letters, digits, dots, underscores and hyphens","Replace spaces with hyphens or underscores","Update any resource.toml references to match the corrected name"],"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"}