{"record":{"id":"10808a0185c57417","repo":"hashicorp/nomad","slug":"task-group-service-check-validation-failed-v","errorCode":null,"errorMessage":"Task group service check validation failed: %v","messagePattern":"Task group service check validation failed: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":7306,"sourceCode":"\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 {\n\t\t\touter := fmt.Errorf(\"Task %s validation failed: %v\", task.Name, err)\n\t\t\tmErr = multierror.Append(mErr, outer)\n\t\t}\n\t}\n\n\treturn mErr.ErrorOrNil()","sourceCodeStart":7288,"sourceCodeEnd":7324,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L7288-L7324","documentation":"TaskGroup.Validate calls tg.validateScriptChecksInGroupServices() and wraps failures as \"Task group service check validation failed: %v\", appending to the job multierror. It targets script-type checks attached to group-level services, which carry extra restrictions (task to execute in, driver support, consul/nomad provider capabilities).","triggerScenarios":"Submitting a group `service` with a `check` of type \"script\" that is invalid: missing `task` field naming a task in the group, the named task's driver lacking script exec support, script checks unsupported for provider = \"nomad\", or invalid splay/timeout combinations.","commonSituations":"Adding a script check to a group service without specifying which task runs it; enabling script checks with a driver that can't exec (e.g. isolated runtimes); upgrading Nomad/Consul where script check support or ACL requirements changed.","solutions":["Set the `task` field on the script check to a valid task name in the group.","Ensure that task's driver supports script checks (exec capability) on the target clients.","Switch to http/tcp checks if the environment (provider/ACLs) disallows script checks."],"exampleFix":"// before\nservice {\n  name = \"web\"\n  check {\n    type = \"script\"\n    command = \"/bin/check.sh\"\n  }\n}\n// after\nservice {\n  name = \"web\"\n  check {\n    type = \"script\"\n    task = \"app\"\n    command = \"/bin/check.sh\"\n  }\n}","handlingStrategy":"validation","validationCode":"// Go: script checks in group services must target a task\nfor _, s := range tg.Services {\n  for _, c := range s.Checks {\n    if c.Type == \"script\" && c.TaskName == \"\" {\n      return fmt.Errorf(\"service %q: script check requires task field\", s.Name)\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set `task` on script checks attached to group services.","Verify the target task's driver supports script execution.","Fall back to http/tcp checks when script checks are unsupported in the environment."],"tags":["nomad","job-validation","services","health-checks"],"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"}