hashicorp/nomad · error
binary %q does not exist
Error message
binary %q does not exist
What it means
makeExecutable stat's the binary path before chmod'ing it executable; if os.Stat returns os.IsNotExist, the executor returns 'binary %q does not exist'. Raised from Launch, meaning the configured absolute binary path points to a file that is not on disk.
Source
Thrown at drivers/shared/executor/executor.go:781
// Check the $PATH
if host, err := exec.LookPath(bin); err == nil {
return host, nil
}
return "", fmt.Errorf("binary %q could not be found", bin)
}
// makeExecutable makes the given file executable for root,group,others.
func makeExecutable(binPath string) error {
if runtime.GOOS == "windows" {
return nil
}
fi, err := os.Stat(binPath)
if err != nil {
if os.IsNotExist(err) {
return fmt.Errorf("binary %q does not exist", binPath)
}
return fmt.Errorf("specified binary is invalid: %v", err)
}
// If it is not executable, make it so.
perm := fi.Mode().Perm()
req := os.FileMode(0555)
if perm&req != req {
if err := os.Chmod(binPath, perm|req); err != nil {
return fmt.Errorf("error making %q executable: %s", binPath, err)
}
}
return nil
}
// SupportedCaps returns a list of all supported capabilities in kernel.
func SupportedCaps(allowNetRaw bool) []string {
var allCaps []stringView on GitHub (pinned to 482b49bf1a)
Solutions
- Verify the absolute path exists on the client with 'ls -l <path>'
- For chroot/isolated drivers, ensure the binary is inside the chroot or listed in the driver's allowed/chroot mappings
- Install the binary on every client node or distribute it via an artifact block
- Correct the path typo in the task config
Example fix
// before
config { command = "/opt/app/bin/server" } // not installed on this client
// after
artifact { source = ".../server.tar.gz" }
config { command = "NOMAD_TASK_DIR/server" } Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Stat(binPath); err != nil {
if os.IsNotExist(err) {
return fmt.Errorf("binary %s missing on client; deploy it or fix the path", binPath)
}
return fmt.Errorf("cannot access %s: %w", binPath, err)
} Type guard
func binaryExists(path string) bool {
fi, err := os.Stat(path)
return err == nil && !fi.IsDir()
} Try / catch
if err := client.Launch(...); err != nil {
if strings.Contains(err.Error(), "does not exist") {
return fmt.Errorf("bad absolute path in task config: %w", err)
}
return err
} Prevention
- Verify the absolute path exists on every client the task can schedule to
- For chroot/isolated drivers, keep binaries inside the chroot or map them in driver config
- Use artifact blocks to ship the binary with the task
- Lint job specs to require absolute paths that were smoke-tested on a client
When it happens
Trigger: Launching a task with an absolute command path that doesn't exist on the client host (wrong path, binary not installed, path inside a chroot/isolated driver filesystem that lacks it).
Common situations: Path typo in job spec; binary deployed to a different location per host; chroot driver (e.g. exec driver) where the binary exists on the host but outside the chroot and isn't in the allowed paths; container image missing the binary.
Related errors
- file %q is a directory
- binary %q could not be found
- specified binary is invalid: %v
- failed to stat %s: %v
- unable to read rooted allocation directory
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/f7b1a1632c350b28.
Report an issue: GitHub.