hashicorp/nomad · error
failed to determine absolute path for %s
Error message
failed to determine absolute path for %s
What it means
In StorageFingerprint.diskInfo, filepath.Abs fails to compute an absolute path for the host volume path being fingerprinted (e.g. malformed path input), so disk capacity/volume detection for the storage fingerprint cannot proceed and the error propagates to Fingerprint.
Source
Thrown at client/fingerprint/storage_unix.go:22
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
package fingerprint
import (
"fmt"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"strings"
)
// diskInfo inspects the filesystem for path and returns the volume name and
// the total bytes available on the file system.
func (f *StorageFingerprint) diskInfo(path string) (volume string, total uint64, err error) {
absPath, err := filepath.Abs(path)
if err != nil {
return "", 0, fmt.Errorf("failed to determine absolute path for %s", path)
}
// Use -k to standardize the output values between darwin and linux
var dfArgs string
if runtime.GOOS == "linux" {
// df on linux needs the -P option to prevent linebreaks on long filesystem paths
dfArgs = "-kP"
} else {
dfArgs = "-k"
}
mountOutput, err := exec.Command("df", dfArgs, absPath).Output()
if err != nil {
return "", 0, fmt.Errorf("failed to determine mount point for %s", absPath)
}
// Output looks something like:
// Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on
// /dev/disk1 487385240 423722532 63406708 87% 105994631 15851677 87% /View on GitHub (pinned to 482b49bf1a)
Solutions
- Pass an absolute path as the storage/alloc directory.
- Recreate the deleted working directory or restart the client from a valid directory.
- Check permissions on the process's current directory.
Example fix
// before alloc_dir = "data/alloc" // relative, CWD deleted // after alloc_dir = "/opt/nomad/data/alloc" // absolute
Defensive patterns
Strategy: validation
Validate before calling
if !filepath.IsAbs(path) {
abs, err := filepath.Abs(path)
if err != nil {
return fmt.Errorf("cannot resolve %s to absolute path: %w", path, err)
}
path = abs
} Try / catch
if err := fp.Fingerprint(req); err != nil {
if strings.Contains(err.Error(), "failed to determine absolute path") {
log.Printf("path resolution failed: %v", err)
return nil
}
return err
} Prevention
- Configure absolute paths for alloc_dir.
- Ensure the process has a valid working directory (CWD not deleted).
- Test os.Getwd() in startup checks for relative-path setups.
When it happens
Trigger: diskInfo called with a relative path while the process has no resolvable working directory (os.Getwd fails inside filepath.Abs), e.g. after the CWD was deleted.
Common situations: Client started in a deleted directory with a relative alloc_dir configured; restricted environments where Getwd returns ENOENT.
Related errors
- unable to get CWD from filesystem: %s
- failed to determine disk space for %s: %v
- failed to determine mount point for %s
- failed to parse `df` output; expected at least 2 lines
- failed to parse `df` output; expected at least 4 columns
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/436a599f0ee639e3.
Report an issue: GitHub.