{"record":{"id":"8ae83bb0023c5091","repo":"hashicorp/nomad","slug":"invalid-name-q-must-match-regex-s-8ae83b","errorCode":null,"errorMessage":"invalid name %q, must match regex %s","messagePattern":"invalid name %q, must match regex (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/vault.go","lineNumber":18,"sourceCode":"// Copyright IBM Corp. 2015, 2026\n// SPDX-License-Identifier: BUSL-1.1\n\npackage structs\n\nimport (\n\t\"fmt\"\n)\n\nconst (\n\t// VaultDefaultCluster is the name used for the Vault cluster that doesn't\n\t// have a name.\n\tVaultDefaultCluster = \"default\"\n)\n\nfunc ValidateVaultClusterName(cluster string) error {\n\tif !validConsulVaultClusterName.MatchString(cluster) {\n\t\treturn fmt.Errorf(\"invalid name %q, must match regex %s\", cluster, validConsulVaultClusterName)\n\t}\n\n\treturn nil\n}\n\n// GetVaultClusterName gets the Vault cluster for this task. Only a single\n// default cluster is supported in Nomad CE, but this function can be safely\n// used for ENT as well because the appropriate Cluster value will be set at the\n// time of job submission.\nfunc (t *Task) GetVaultClusterName() string {\n\tif t.Vault != nil && t.Vault.Cluster != \"\" {\n\t\treturn t.Vault.Cluster\n\t}\n\treturn VaultDefaultCluster\n}\n","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/vault.go#L1-L34","documentation":"ValidateVaultClusterName: the Vault cluster name does not match the same regex used for Consul cluster names (validConsulVaultClusterName). Nomad CE supports only the default cluster name, and non-default names must be DNS-safe per the regex shown in the error.","triggerScenarios":"Thrown at nomad/structs/vault.go:18 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the cluster using only regex-compliant characters (alphanumerics, dashes)","Check for typos, spaces, or slashes in the cluster name"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}