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
- Install the missing binary on the Nomad client host (e.g. openjdk-17-jre) or fix the binary name in the task config.
- Verify with `which <bin>` as the same user the nomad agent runs as; systemd units often have a minimal PATH.
- Use an absolute path to the executable in the task config instead of relying on PATH lookup.
- 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
- Verify `which <bin>` as the same user the nomad agent runs as (systemd PATH differs from shells).
- Prefer absolute paths in task configs over PATH-dependent binary names.
- Use driver fingerprint/health checks to detect missing binaries before placement.
- Install JVMs via the OS package manager so they land on standard PATHs.
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
- default_pid_mode must be %q or %q, got %q
- default_ipc_mode must be %q or %q, got %q
- allow_caps configured with capabilities not supported by sys
- pid_mode must be %q or %q, got %q
- ipc_mode must be %q or %q, got %q
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/9d2e954751b21832.
Report an issue: GitHub.