{"record":{"id":"12987c50aa8148e7","repo":"hashicorp/nomad","slug":"group-q-references-task-q-in-a-service-definitio","errorCode":null,"errorMessage":"group %q references task %q in a service definition, but the task has no shutdown_delay set","messagePattern":"group %q references task %q in a service definition, but the task has no shutdown_delay set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"nomad/structs/structs.go","lineNumber":4932,"sourceCode":"\t\t\treferencedTaskIDs[s.TaskName] = struct{}{}\n\t\t\tcontinue\n\t\t}\n\n\t\tif s.Connect != nil && s.Connect.SidecarTask != nil {\n\t\t\tif s.Connect.SidecarTask.ShutdownDelay == nil {\n\t\t\t\twarnings = append(warnings, fmt.Errorf(\n\t\t\t\t\t\"service %q defines a sidecar task in Consul Connect definition, but the task has no shutdown_delay set\",\n\t\t\t\t\ts.Name))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\thasUnscopedGroupService = true\n\t}\n\n\tfor _, t := range tg.Tasks {\n\t\tif _, ok := referencedTaskIDs[t.Name]; ok && t.ShutdownDelay == 0 {\n\t\t\twarnings = append(warnings, fmt.Errorf(\n\t\t\t\t\"group %q references task %q in a service definition, but the task has no shutdown_delay set\",\n\t\t\t\ttg.Name, t.Name))\n\t\t}\n\n\t\tif t.ShutdownDelay > 0 {\n\t\t\tanyTaskHasShutdownDelay = true\n\t\t} else if len(t.Services) > 0 {\n\t\t\twarnings = append(warnings, fmt.Errorf(\n\t\t\t\t\"task %q in group %q defines services, but has no shutdown_delay set\",\n\t\t\t\tt.Name, tg.Name))\n\t\t}\n\t}\n\n\tif hasUnscopedGroupService && !hasGroupShutdownDelay && !anyTaskHasShutdownDelay {\n\t\twarnings = append(warnings, fmt.Errorf(\n\t\t\t\"group %q defines services, but neither the group nor any of its tasks have shutdown_delay set\", tg.Name))\n\t}\n","sourceCodeStart":4914,"sourceCodeEnd":4950,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L4914-L4950","documentation":"A warning from TaskGroup.Warnings: when the group's service definition references a task by name (via SidecarTask-like task references tracked in referencedTaskIDs) and that task's ShutdownDelay is 0, Nomad warns that the referenced task has no shutdown_delay. This helps ensure graceful draining for connect sidecars and service churn.","triggerScenarios":"A group service (or connect sidecar) references a task by name, and the referenced task in tg.Tasks has ShutdownDelay == 0 at validation time. Surfaced through CLI warning formatting (Meta.FormatWarnings).","commonSituations":"Group-level connect sidecars referencing app tasks; tasks defined without a shutdown_delay while services point at them; specs copied from examples predating shutdown_delay defaults.","solutions":["Set `shutdown_delay` on the referenced task in the group.","Or acknowledge the warning if connection draining is not a concern for that workload.","Re-run `nomad job validate` after edits to confirm the warning is gone."],"exampleFix":"// before\ntask \"app\" { driver = \"docker\" }\n// after\ntask \"app\" { driver = \"docker\"; shutdown_delay = \"5s\" }","handlingStrategy":"validation","validationCode":"for _, t := range group.Tasks {\n    if t.ShutdownDelay == 0 {\n        log.Warnf(\"task %q referenced by services has no shutdown_delay\", t.Name)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set shutdown_delay on any task referenced by service definitions.","Review group service references when adding new tasks.","Check warning output of `nomad job run` after each spec change."],"tags":["nomad","service-definition","shutdown-delay","task-group"],"backgroundTag":"missing-shutdown-delay","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"}