{"record":{"id":"2197755941414870","repo":"hashicorp/nomad","slug":"task-q-has-warnings-v","errorCode":null,"errorMessage":"Task %q has warnings: %v","messagePattern":"Task %q has warnings: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"nomad/structs/structs.go","lineNumber":7692,"sourceCode":"\t\t)\n\t}\n\n\t// Check for mbits network field\n\tif len(tg.Networks) > 0 && tg.Networks[0].MBits > 0 {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"mbits has been deprecated as of Nomad 0.12.0. Please remove mbits from the network block\"))\n\t}\n\n\t// Validate group-level services.\n\tfor _, s := range tg.Services {\n\t\tif err := s.Warnings(); err != nil {\n\t\t\terr = multierror.Prefix(err, fmt.Sprintf(\"Service %q:\", s.Name))\n\t\t\tmErr = *multierror.Append(&mErr, err)\n\t\t}\n\t}\n\n\tfor _, t := range tg.Tasks {\n\t\tif err := t.Warnings(); err != nil {\n\t\t\touter := fmt.Errorf(\"Task %q has warnings: %v\", t.Name, err)\n\t\t\tmErr.Errors = append(mErr.Errors, outer)\n\t\t}\n\t}\n\n\treturn mErr.ErrorOrNil()\n}\n\n// LookupTask finds a task by name\nfunc (tg *TaskGroup) LookupTask(name string) *Task {\n\tfor _, t := range tg.Tasks {\n\t\tif t.Name == name {\n\t\t\treturn t\n\t\t}\n\t}\n\treturn nil\n}\n\n// UsesConnect for convenience returns true if the TaskGroup contains at least","sourceCodeStart":7674,"sourceCodeEnd":7710,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L7674-L7710","documentation":"Task validation produced non-fatal warnings; this wrapper prefixes each task's warnings with 'Task %q has warnings: %v' inside the group's Warnings() aggregation. Job submission still succeeds; the message surfaces dubious settings like deprecated fields or suboptimal defaults.","triggerScenarios":"Submitting (or `nomad job run`/`plan` on) a job whose task's Warnings() returns non-nil — e.g. deprecated template/artifact/log options or questionable driver configs. (The test references are command/job_allocs_test.go using nomad job allocs command error output.)","commonSituations":"Jobs upgraded across Nomad versions carrying deprecated task-level fields; typos in optional fields that only merit a warning; CI output where warnings are treated as noise.","solutions":["Read the text after 'has warnings:' — it names the exact dubious setting","Fix or remove the deprecated/unsupported field named in the wrapped warning","Re-run `nomad job validate` to confirm warnings are cleared"],"exampleFix":"// before (example)\nlogs { max_files = 0 }\n// after\nlogs { max_files = 2 }","handlingStrategy":"validation","validationCode":"if _, err := task.Warnings(); err != nil {\n  log.Printf(\"task %s warnings: %v\", task.Name, err)\n}","typeGuard":null,"tryCatchPattern":"job, err := jobsAPI.Validate(opts)\nif err != nil {\n  var me *multierror.Error\n  if errors.As(err, &me) {\n    for _, e := range me.Errors {\n      if strings.Contains(e.Error(), \"has warnings\") {\n        log.Warnf(\"non-fatal job warning: %v\", e)\n      }\n    }\n  }\n}","preventionTips":["Fail CI on `nomad job validate` warning output","Track Nomad release notes for deprecated task fields","Unwrap and log the inner warning text, not just the Task %q wrapper"],"tags":["nomad","task","warnings"],"backgroundTag":"deprecated-field-usage","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"}