{"record":{"id":"841cf9a11c4827c8","repo":"hashicorp/nomad","slug":"group-q-has-warnings-v","errorCode":null,"errorMessage":"Group %q has warnings: %v","messagePattern":"Group %q has warnings: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"nomad/structs/structs.go","lineNumber":4964,"sourceCode":"\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\n\treturn warnings\n}\n\n// Warnings returns a list of warnings that may be from dubious settings or\n// deprecation warnings.\nfunc (j *Job) Warnings() error {\n\tvar mErr multierror.Error\n\n\t// Check the groups\n\thasAutoPromote, allAutoPromote := false, true\n\n\tfor _, tg := range j.TaskGroups {\n\t\tif err := tg.Warnings(j); err != nil {\n\t\t\touter := fmt.Errorf(\"Group %q has warnings: %v\", tg.Name, err)\n\t\t\tmErr.Errors = append(mErr.Errors, outer)\n\t\t}\n\n\t\tif u := tg.Update; u != nil {\n\t\t\thasAutoPromote = hasAutoPromote || u.AutoPromote\n\n\t\t\t// Having no canaries implies auto-promotion since there are no canaries to promote.\n\t\t\tallAutoPromote = allAutoPromote && (u.Canary == 0 || u.AutoPromote)\n\t\t}\n\t}\n\n\t// check if we have services with no shutdown delay set\n\tmErr.Errors = append(mErr.Errors, j.generateServiceShutdownDelayWarnings()...)\n\n\t// Check AutoPromote, should be all or none\n\tif hasAutoPromote && !allAutoPromote {\n\t\terr := fmt.Errorf(\"auto_promote must be true for all groups to enable automatic promotion\")\n\t\tmErr.Errors = append(mErr.Errors, err)","sourceCodeStart":4946,"sourceCodeEnd":4982,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L4946-L4982","documentation":"Job.Validate collects per-group warnings by calling tg.Warnings(j) and wraps any returned error as 'Group %q has warnings: %v' inside the returned multi-error. It aggregates the shutdown_delay family of warnings (3083-3086) plus other group-level advisory checks, so the inner %v lists what the group flags.","triggerScenarios":"Validating a job whose task groups return warnings from TaskGroup.Warnings — e.g. services without shutdown_delay, connect sidecar issues. Surfaced through `nomad job run`/`validate` warning output and any CLI path that calls Validate and prints warnings.","commonSituations":"Deploying connect-enabled services without drain delays; CI that fails on stderr warnings; operators misreading warnings as hard failures (the job may still be submittable depending on the calling command).","solutions":["Read the inner %v text to see which group warnings were raised.","Fix the flagged advisory issues (typically add shutdown_delay values).","Optionally downgrade noise by configuring services/tasks deliberately and documenting accepted warnings.","Re-run validation to confirm the warning list is empty."],"exampleFix":"// before\ngroup \"api\" {\n  task \"api\" { service { name = \"api\" } }\n}\n// after\ngroup \"api\" {\n  task \"api\" { shutdown_delay = \"5s\"; service { name = \"api\" } }\n}","handlingStrategy":"validation","validationCode":"for _, tg := range job.TaskGroups {\n    if warns := tg.Warnings(job); warns != nil {\n        log.Warnf(\"group %q warnings: %v\", tg.Name, warns)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Capture and review warning text, not just exit codes, from job commands.","Fix grouped warnings (usually shutdown_delay) at the group level.","Keep per-group stanzas consistent across a job."],"tags":["nomad","warnings","task-group","job-validation"],"backgroundTag":"job-spec-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"}