hashicorp/nomad · warning

Task %q has warnings: %v

Error message

Task %q has warnings: %v

What it means

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.

Source

Thrown at nomad/structs/structs.go:7692

		)
	}

	// Check for mbits network field
	if len(tg.Networks) > 0 && tg.Networks[0].MBits > 0 {
		mErr.Errors = append(mErr.Errors, fmt.Errorf("mbits has been deprecated as of Nomad 0.12.0. Please remove mbits from the network block"))
	}

	// Validate group-level services.
	for _, s := range tg.Services {
		if err := s.Warnings(); err != nil {
			err = multierror.Prefix(err, fmt.Sprintf("Service %q:", s.Name))
			mErr = *multierror.Append(&mErr, err)
		}
	}

	for _, t := range tg.Tasks {
		if err := t.Warnings(); err != nil {
			outer := fmt.Errorf("Task %q has warnings: %v", t.Name, err)
			mErr.Errors = append(mErr.Errors, outer)
		}
	}

	return mErr.ErrorOrNil()
}

// LookupTask finds a task by name
func (tg *TaskGroup) LookupTask(name string) *Task {
	for _, t := range tg.Tasks {
		if t.Name == name {
			return t
		}
	}
	return nil
}

// UsesConnect for convenience returns true if the TaskGroup contains at least

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Read the text after 'has warnings:' — it names the exact dubious setting
  2. Fix or remove the deprecated/unsupported field named in the wrapped warning
  3. Re-run `nomad job validate` to confirm warnings are cleared

Example fix

// before (example)
logs { max_files = 0 }
// after
logs { max_files = 2 }
Defensive patterns

Strategy: validation

Validate before calling

if _, err := task.Warnings(); err != nil {
  log.Printf("task %s warnings: %v", task.Name, err)
}

Try / catch

job, err := jobsAPI.Validate(opts)
if err != nil {
  var me *multierror.Error
  if errors.As(err, &me) {
    for _, e := range me.Errors {
      if strings.Contains(e.Error(), "has warnings") {
        log.Warnf("non-fatal job warning: %v", e)
      }
    }
  }
}

Prevention

When it happens

Trigger: 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.)

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/2197755941414870. Report an issue: GitHub.