hashicorp/nomad · error

failed to resolve path to %q executable: %v

Error message

failed to resolve path to %q executable: %v

What it means

GetAbsolutePath resolves a binary via exec.LookPath and returns this error when the binary cannot be found in PATH. In the QEMU driver it is called during StartTask to locate the qemu-system binary, failing task startup.

Source

Thrown at drivers/qemu/driver.go:823

func (d *Driver) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error) {
	return d.eventer.TaskEvents(ctx)
}

func (d *Driver) SignalTask(_ string, _ string) error {
	return fmt.Errorf("QEMU driver can't signal commands")
}

func (d *Driver) ExecTask(_ string, _ []string, _ time.Duration) (*drivers.ExecTaskResult, error) {
	return nil, fmt.Errorf("QEMU driver can't execute commands")

}

// GetAbsolutePath returns the absolute path of the passed binary by resolving
// it in the path and following symlinks.
func GetAbsolutePath(bin string) (string, error) {
	lp, err := exec.LookPath(bin)
	if err != nil {
		return "", fmt.Errorf("failed to resolve path to %q executable: %v", bin, err)
	}

	return filepath.EvalSymlinks(lp)
}

func (d *Driver) handleWait(ctx context.Context, handle *taskHandle, ch chan *drivers.ExitResult) {
	defer close(ch)
	var result *drivers.ExitResult
	ps, err := handle.exec.Wait(ctx)
	if err != nil {
		result = &drivers.ExitResult{
			Err: fmt.Errorf("executor: error waiting on process: %v", err),
		}
		// if process state is nil, we've probably been killed, so return a reasonable
		// exit state to the handlers
		if ps == nil {
			result.ExitCode = -1
			result.OOMKilled = false

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Install qemu-system-x86 (or the arch-specific package) on the Nomad client
  2. Set the full absolute path to the QEMU binary in the driver/task configuration instead of relying on PATH
  3. Fix PATH for the Nomad agent service (e.g. systemd Environment= or ExecStart wrapper)
  4. Verify with `which qemu-system-x86_64` as the same user the agent runs as

Example fix

// before
image_path = "qemu-system-x86_64" // resolved via PATH, fails if not found
// after
image_path = "/usr/bin/qemu-system-x86_64" // absolute path bypasses PATH lookup
Defensive patterns

Strategy: validation

Validate before calling

path, err := exec.LookPath(qemuBin)
if err != nil {
    return fmt.Errorf("qemu binary %q not found in PATH: %w", qemuBin, err)
}

Try / catch

if _, err := qemu.GetAbsolutePath(qemuBin); err != nil {
    // fail fast with a clear message before StartTask
    return err
}

Prevention

When it happens

Trigger: StartTask with driver config pointing to a qemu binary name (e.g. "qemu-system-x86_64") that exec.LookPath cannot resolve on the Nomad client host.

Common situations: QEMU not installed on the host; PATH differs between the Nomad agent environment and user shell (systemd service with minimal PATH); binary installed under a non-PATH directory; typo in driver config image/binary path.

Related errors


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