hashicorp/nomad · error

Missing task driver

Error message

Missing task driver

What it means

Task.Validate requires a non-empty Driver; the driver string selects which task runner (docker, exec, java, etc.) executes the task. Without a driver Nomad cannot launch the task, so validation fails.

Source

Thrown at nomad/structs/structs.go:8247

	var mErr multierror.Error
	if t.Name == "" {
		mErr.Errors = append(mErr.Errors, errors.New("Missing task name"))
	}

	// Tasks cannot be named "alloc" as this conflicts with and breaks task
	// filesystem isolation features.
	if t.Name == "alloc" {
		mErr.Errors = append(mErr.Errors, errors.New("Task cannot be named \"alloc\""))
	}
	if strings.ContainsAny(t.Name, `/\`) {
		// We enforce this so that when creating the directory on disk it will
		// not have any slashes.
		mErr.Errors = append(mErr.Errors, errors.New("Task name cannot include slashes"))
	} else if strings.Contains(t.Name, "\000") {
		mErr.Errors = append(mErr.Errors, errors.New("Task name cannot include null characters"))
	}
	if t.Driver == "" {
		mErr.Errors = append(mErr.Errors, errors.New("Missing task driver"))
	}
	if t.KillTimeout < 0 {
		mErr.Errors = append(mErr.Errors, errors.New("KillTimeout must be a positive value"))
	} else {
		// Validate the group's update strategy does not conflict with the
		// task's kill_timeout for service jobs.
		//
		// progress_deadline = 0 has a special meaning so it should not be
		// validated against the task's kill_timeout.
		conflictsWithProgressDeadline := jobType == JobTypeService &&
			tg.Update != nil &&
			tg.Update.ProgressDeadline > 0 &&
			t.KillTimeout > tg.Update.ProgressDeadline
		if conflictsWithProgressDeadline {
			mErr.Errors = append(mErr.Errors, fmt.Errorf("KillTimout (%s) longer than the group's ProgressDeadline (%s)",
				t.KillTimeout, tg.Update.ProgressDeadline))
		}
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set the driver field, e.g. driver = "docker".
  2. Ensure only drivers enabled in the client config are used (a separate runtime error otherwise).
  3. Validate before submit.

Example fix

// before
task "app" {
  config {
    image = "nginx"
  }
}
// after
task "app" {
  driver = "docker"
  config {
    image = "nginx"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

if t.Driver == "" {
  return fmt.Errorf("task %q missing driver", t.Name)
}

Type guard

func hasDriver(t *structs.Task) bool {
  return t != nil && t.Driver != ""
}

Prevention

When it happens

Trigger: A task block without a `driver` field, or structs.Task with Driver unset when constructed programmatically.

Common situations: Hand-written HCL omitting driver; generated jobs where the driver was conditional and defaulted to empty.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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