{"record":{"id":"d86d015c7e762dd7","repo":"hashicorp/nomad","slug":"task-group-service-validation-failed-v","errorCode":null,"errorMessage":"Task group service validation failed: %v","messagePattern":"Task group service validation failed: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":7300,"sourceCode":"\tif tg.Update != nil {\n\t\tcanaries = tg.Update.Canary\n\t}\n\tfor name, volReq := range tg.Volumes {\n\t\tif err := volReq.Validate(j.Type, tg.Count, canaries); err != nil {\n\t\t\tmErr = multierror.Append(mErr, fmt.Errorf(\n\t\t\t\t\"Task group volume validation for %s failed: %v\", name, err))\n\t\t}\n\t}\n\n\t// Validate task group and task network resources\n\tif err := tg.validateNetworks(); err != nil {\n\t\touter := fmt.Errorf(\"Task group network validation failed: %v\", err)\n\t\tmErr = multierror.Append(mErr, outer)\n\t}\n\n\t// Validate task group and task services\n\tif err := tg.validateServices(); err != nil {\n\t\touter := fmt.Errorf(\"Task group service validation failed: %v\", err)\n\t\tmErr = multierror.Append(mErr, outer)\n\t}\n\n\t// Validate group service script-checks\n\tif err := tg.validateScriptChecksInGroupServices(); err != nil {\n\t\touter := fmt.Errorf(\"Task group service check validation failed: %v\", err)\n\t\tmErr = multierror.Append(mErr, outer)\n\t}\n\n\t// Validate the scaling policy\n\tif err := tg.validateScalingPolicy(j); err != nil {\n\t\touter := fmt.Errorf(\"Task group scaling policy validation failed: %v\", err)\n\t\tmErr = multierror.Append(mErr, outer)\n\t}\n\n\t// Validate the tasks\n\tfor _, task := range tg.Tasks {\n\t\tif err := task.Validate(j.Type, tg); err != nil {","sourceCodeStart":7282,"sourceCodeEnd":7318,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L7282-L7318","documentation":"TaskGroup.Validate calls tg.validateServices() and wraps any failure as \"Task group service validation failed: %v\" before appending to the job multierror. The wrapped error comes from Service.Validate and covers malformed service definitions attached to the group (provider, name, address mode, check configuration).","triggerScenarios":"Submitting a job with a group-level `service` block failing validation: empty/invalid service name, unsupported `provider` (not consul/nomad), invalid address_mode, bad check address/interval, using fields unsupported by the chosen provider.","commonSituations":"Typos in provider name; using consul-only check fields with provider = \"nomad\"; invalid service name characters; address mode \"host\" with bridge networking misunderstandings.","solutions":["Read the wrapped inner error and fix the specific field in the failing `service` block.","Validate provider is exactly \"consul\" or \"nomad\" and only use fields that provider supports.","Ensure service name is non-empty and contains only valid characters."],"exampleFix":"// before\nservice {\n  name = \"\"\n  provider = \"nomad\"\n  check { type = \"http\" address_mode = \"host\" }\n}\n// after\nservice {\n  name = \"web\"\n  provider = \"nomad\"\n  check { type = \"http\" port = \"http\" }\n}","handlingStrategy":"validation","validationCode":"// Go: basic service sanity before submission\nfor _, s := range tg.Services {\n  if s.Name == \"\" {\n    return fmt.Errorf(\"service name required\")\n  }\n  if s.Provider != \"\" && s.Provider != \"consul\" && s.Provider != \"nomad\" {\n    return fmt.Errorf(\"service %q: invalid provider %q\", s.Name, s.Provider)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match service fields to the declared provider's capabilities.","Test service definitions against the target Consul/Nomad versions.","Run `nomad job validate` in CI to catch provider/check mismatches early."],"tags":["nomad","job-validation","services","consul"],"backgroundTag":"nomad-job-validation-failed","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"}