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 (searching $PATH) and then canonicalizes symlinks with filepath.EvalSymlinks. If LookPath cannot find the executable in any PATH directory, the driver wraps the underlying error with this message. It is thrown when starting a task whose driver configuration references a binary that is not installed or not on PATH.

Source

Thrown at drivers/java/driver.go:752

	stream drivers.ExecTaskStream) error {

	if len(command) == 0 {
		return fmt.Errorf("error cmd must have at least one value")
	}
	handle, ok := d.tasks.Get(taskID)
	if !ok {
		return drivers.ErrTaskNotFound
	}

	return handle.exec.ExecStreaming(ctx, command, tty, stream)
}

// 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)
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Install the missing binary on the Nomad client host (e.g. openjdk-17-jre) or fix the binary name in the task config.
  2. Verify with `which <bin>` as the same user the nomad agent runs as; systemd units often have a minimal PATH.
  3. Use an absolute path to the executable in the task config instead of relying on PATH lookup.
  4. Check file permissions (chmod +x) and that the binary is for the correct OS/architecture.

Example fix

// before (task config)
command = "java8"
// after
command = "/usr/lib/jvm/java-17-openjdk-amd64/bin/java"
Defensive patterns

Strategy: validation

Validate before calling

lp, err := exec.LookPath("java")
if err != nil {
    return fmt.Errorf("java not on PATH for nomad agent user: %w", err)
}

Try / catch

if _, err := driver.GetAbsolutePath("java"); err != nil {
    // treat as environment problem: fail placement, surface inner LookPath error
    return fmt.Errorf("java driver unavailable: %w", err)
}

Prevention

When it happens

Trigger: StartTask calls GetAbsolutePath(bin) with a binary name like "java" that exec.LookPath cannot locate on the host (or in the chroot/image) the Nomad client runs in.

Common situations: JVM not installed on the Nomad client; task 'driver.config' or task command references a binary under a name that exists only in the user's shell (alias or shell function); PATH differs between interactive shell and the nomad agent systemd unit; binary exists but lacks execute permission.

Related errors


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