hashicorp/nomad · error
File %s not found in path %s
Error message
File %s not found in path %s
What it means
FindFileInPath walks the directory tree rooted at p looking for a file whose base name matches the given file name. This error is returned when the walk completed without any walk errors but the file was never encountered — the named file simply does not exist anywhere under p.
Source
Thrown at helper/raftutil/state.go:351
walkFn := func(walkPath string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if filepath.Base(walkPath) == file {
path = walkPath
}
return nil
}
// Walk path p looking for file
walkErr := filepath.Walk(p, walkFn)
if walkErr != nil {
return "", walkErr
}
if path == "" {
return "", fmt.Errorf("File %s not found in path %s", file, p)
}
return path, nil
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Use FindRaftStore instead of the raft.db-only FindRaftFile/FindFileInPath so WAL (wal/) deployments are also detected.
- Confirm the path is the Nomad server data_dir containing server/raft/raft.db: ls <p>/server/raft/raft.db.
- If targeting a WAL deployment, pass the wal/ directory directly (FindRaftStore accepts it).
- Restore raft.db from backup or take a nomad snapshot if the file was lost.
- Double-check you are searching the correct host/volume (e.g. the actual server node, not a standby with an empty dir).
Example fix
// before: only searches for raft.db, fails on WAL deployments
path, err := raftutil.FindFileInPath("raft.db", dataDir)
// after: prefer the backend-aware search
storePath, err := raftutil.FindRaftStore(dataDir) Defensive patterns
Strategy: fallback
Validate before calling
// confirm a raft.db actually exists under the tree before searching
found := false
filepath.Walk(dataDir, func(p string, info os.FileInfo, err error) error {
if err == nil && !info.IsDir() && info.Name() == "raft.db" {
found = true
}
return nil
})
if !found { return errors.New("data dir has no raft.db; WAL backend? use FindRaftStore") } Try / catch
path, err := raftutil.FindFileInPath("raft.db", dataDir)
if err != nil {
if strings.Contains(err.Error(), "not found in path") {
// fall back to backend-aware search (handles wal/ too)
return raftutil.FindRaftStore(dataDir)
}
return err
} Prevention
- Prefer FindRaftStore over FindFileInPath/FindRaftFile for WAL support.
- Verify the server data dir layout before running searches.
- Check you are on the right host/volume/backup mount.
- Confirm the file wasn't removed by cleanup scripts.
When it happens
Trigger: FindFileInPath("raft.db", p) (via FindRaftStore or FindRaftFile) on a directory tree that contains no file named raft.db at any depth.
Common situations: Pointing the recovery/inspection tooling at a WAL-backend data dir (which has wal/ but no raft.db); client-only or empty data directories; the raft.db file was deleted or moved; searching the wrong volume/backup mount.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- no raft store (raft.db or wal/) found in %s
- failed to determine absolute path for %s
- failed to find raft store in %v: %v
- failed to open snapshot dir: %v
- migration succeeded but failed to rename %s to %s: %w
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/4217054590a927e6.
Report an issue: GitHub.