hashicorp/nomad · error

failed driver config validation: %v

Error message

failed driver config validation: %v

What it means

The decoded rawexec TaskConfig failed its own validate() checks before launching. This guards driver-level invariants such as requiring an explicit command, rejecting path traversal in command paths, and cgroup v2 override path constraints (the value just passed through cgroupslib.CustomPathCG2).

Source

Thrown at drivers/rawexec/driver.go:408

func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error) {
	if !d.config.Enabled {
		return nil, nil, errDisabledDriver
	}

	if _, ok := d.tasks.Get(cfg.ID); ok {
		return nil, nil, fmt.Errorf("task with ID %q already started", cfg.ID)
	}

	var driverConfig TaskConfig
	if err := cfg.DecodeDriverConfig(&driverConfig); err != nil {
		return nil, nil, fmt.Errorf("failed to decode driver config: %v", err)
	}

	driverConfig.OverrideCgroupV2 = cgroupslib.CustomPathCG2(driverConfig.OverrideCgroupV2)

	if err := driverConfig.validate(); err != nil {
		return nil, nil, fmt.Errorf("failed driver config validation: %v", err)
	}

	if err := d.Validate(*cfg); err != nil {
		return nil, nil, fmt.Errorf("failed driver config validation: %v", err)
	}

	d.logger.Info("starting task", "driver_cfg", hclog.Fmt("%+v", driverConfig))
	handle := drivers.NewTaskHandle(taskHandleVersion)
	handle.Config = cfg

	pluginLogFile := filepath.Join(cfg.TaskDir().Dir, "executor.out")
	executorConfig := &executor.ExecutorConfig{
		LogFile:  pluginLogFile,
		LogLevel: "debug",
		Compute:  d.compute,
	}

	logger := d.logger.With("task_name", handle.Config.Name, "alloc_id", handle.Config.AllocID)

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set an absolute 'command' in the job's rawexec config block (e.g. "/bin/sleep")
  2. Remove or fix the cgroup_v2 override path so it matches the host's cgroup v2 mount/custom path
  3. Read the exact wrapped message (%v) for the specific validate() complaint and correct that field
  4. Check the driver's client config (enabled, cgroup settings) matches the host's cgroup version

Example fix

// before
config {
  args = ["10"]
}
// after
config {
  command = "/bin/sleep"
  args    = ["10"]
}
Defensive patterns

Strategy: validation

Validate before calling

// pre-checks before submit
if !strings.HasPrefix(cfg.Command, "/") && path.IsAbs(cfg.Command) == false {
  // rawexec expects an absolute command path
}
if cfg.CgroupV2 != "" { checkCustomCgroupPathExistsOnHost(cfg.CgroupV2) }

Try / catch

h, net, err := d.StartTask(cfg)
if err != nil && strings.Contains(err.Error(), "failed driver config validation") {
  return fmt.Errorf("fix rawexec config block: %w", err)
}

Prevention

When it happens

Trigger: StartTask with a driverConfig whose validate() returns error: empty command, command not an absolute/safe path when required, or invalid OverrideCgroupV2 path.

Common situations: Omitting 'command' in the rawexec config block; specifying cgroup_v2 override pointing to a nonexistent/nonstandard path; relative executable paths on hosts where rawexec requires absolute paths.

Related errors


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