hashicorp/nomad · critical

failed to launch command with executor: %v

Error message

failed to launch command with executor: %v

What it means

The executor was created but exec.Launch(execCmd) failed to actually start the user command. The driver kills the plugin client and returns this error, so the task never runs. The wrapped error carries the executor's reason (exec format error, permission denied, missing binary, cgroup setup failure, etc.).

Source

Thrown at drivers/rawexec/driver.go:451

		Cmd:              driverConfig.Command,
		Args:             driverConfig.Args,
		Env:              d.buildEnvList(&driverConfig, cfg),
		User:             cfg.User,
		TaskDir:          cfg.TaskDir().Dir,
		WorkDir:          driverConfig.WorkDir,
		StdoutPath:       cfg.StdoutPath,
		StderrPath:       cfg.StderrPath,
		NetworkIsolation: cfg.NetworkIsolation,
		Resources:        cfg.Resources.Copy(),
		OverrideCgroupV2: driverConfig.OverrideCgroupV2,
		OverrideCgroupV1: driverConfig.OverrideCgroupV1,
		OOMScoreAdj:      int32(driverConfig.OOMScoreAdj),
	}

	ps, err := exec.Launch(execCmd)
	if err != nil {
		pluginClient.Kill()
		return nil, nil, fmt.Errorf("failed to launch command with executor: %v", err)
	}

	h := &taskHandle{
		exec:         exec,
		pid:          ps.Pid,
		pluginClient: pluginClient,
		taskConfig:   cfg,
		procState:    drivers.TaskStateRunning,
		startedAt:    time.Now().Round(time.Millisecond),
		logger:       d.logger,
		doneCh:       make(chan struct{}),
	}

	driverState := TaskState{
		ReattachConfig: pstructs.ReattachConfigFromGoPlugin(pluginClient.ReattachConfig()),
		Pid:            ps.Pid,
		TaskConfig:     cfg,
		StartedAt:      h.startedAt,

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Verify the command exists and is executable on the client host (or within chroot/task_dir when driver.caps include exec)
  2. Read the wrapped error: 'no such file or directory' → fix path; 'permission denied' → fix exec bit/user; 'operation not permitted' → fix container/capability setup
  3. Check executor logs in the alloc dir for the exact syscall failure
  4. Fix cgroup/namespace related issues (custom cgroup_v2 path, unprivileged user restrictions) or run the client with required privileges

Example fix

// before: non-executable, relative path
config { command = "scripts/app.sh" }
// after: absolute path to an executable
config { command = "/opt/app/bin/app.sh" }
Defensive patterns

Strategy: try-catch

Validate before calling

// before submit, verify the command on the target client
test -x /opt/app/bin/app.sh || echo "command missing or not executable"
file /opt/app/bin/app.sh   # right arch/format for host?

Try / catch

h, net, err := d.StartTask(cfg)
if err != nil {
  var launchErr = "failed to launch command with executor"
  if strings.Contains(err.Error(), launchErr) {
    d.logger.Error("task command failed to launch", "wrapped", err)
    // executor+plugin already killed by driver; surface fix guidance
  }
}

Prevention

When it happens

Trigger: StartTask calls exec.Launch with the ExecCommand and the underlying os/exec or namespace/cgroup setup fails: nonexistent command binary, non-executable file, bad working directory, cgroup v2 creation failure, or fork limits.

Common situations: Wrong 'command' path in the job spec; script lacking +x; task_dir/user mismatch (running as non-root without permission); containerized nomad client missing syscall permissions; cgroup v2 path conflicts on the host.

Related errors


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