{"record":{"id":"2e90dcd7a4650a2b","repo":"hashicorp/nomad","slug":"no-raft-store-raft-db-or-wal-found-in-s","errorCode":null,"errorMessage":"no raft store (raft.db or wal/) found in %s","messagePattern":"no raft store \\(raft\\.db or wal/\\) found in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helper/raftutil/state.go","lineNumber":280,"sourceCode":"\t\t\tcontinue\n\t\t}\n\t\tif c.isDir && info.IsDir() {\n\t\t\treturn c.path, nil\n\t\t}\n\t\tif !c.isDir && !info.IsDir() {\n\t\t\treturn c.path, nil\n\t\t}\n\t}\n\n\t// Accept a direct path to a .db file.\n\tif info, statErr := os.Stat(p); statErr == nil && !info.IsDir() && filepath.Ext(p) == \".db\" {\n\t\treturn p, nil\n\t}\n\n\t// Fall back to filesystem walk for raft.db.\n\tstorePath, err = FindFileInPath(\"raft.db\", p)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"no raft store (raft.db or wal/) found in %s\", p)\n\t}\n\treturn storePath, nil\n}\n\n// FindRaftFile finds raft.db and returns its path. This is a compatibility\n// wrapper; prefer FindRaftStore for code that supports both backends.\nfunc FindRaftFile(p string) (raftpath string, err error) {\n\t// Try known locations before traversal to avoid walking deep structure\n\tif _, err = os.Stat(filepath.Join(p, \"server\", \"raft\", \"raft.db\")); err == nil {\n\t\traftpath = filepath.Join(p, \"server\", \"raft\", \"raft.db\")\n\t} else if _, err = os.Stat(filepath.Join(p, \"raft\", \"raft.db\")); err == nil {\n\t\traftpath = filepath.Join(p, \"raft\", \"raft.db\")\n\t} else if _, err = os.Stat(filepath.Join(p, \"raft.db\")); err == nil {\n\t\traftpath = filepath.Join(p, \"raft.db\")\n\t} else if _, err = os.Stat(p); err == nil && filepath.Ext(p) == \".db\" {\n\t\t// Also accept path to .db file\n\t\traftpath = p\n\t} else {","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/helper/raftutil/state.go#L262-L298","documentation":"FindRaftStore locates a raft log store — either a wal/ directory (WAL backend) or a raft.db file (BoltDB backend) — under path p by checking well-known locations and then walking the tree for raft.db. This error means none of the candidate locations existed and the filesystem walk also failed to find a raft.db file, so p does not contain a usable raft store.","triggerScenarios":"Calling FindRaftStore (directly or via FindRaftDir / Run / NewFSM) with a path p that contains neither server/raft/wal, raft/wal, wal, server/raft/raft.db, raft/raft.db, raft.db, a direct *.db file, nor any raft.db found by walking the tree.","commonSituations":"Passing the Nomad agent config dir or /tmp instead of the data_dir (default /var/lib/nomad or the configured client/server data dir); pointing at a client-only data dir which has no server/raft state; a wiped or never-initialized server data directory; typos or wrong mount paths in recovery tooling.","solutions":["Point the tool at the Nomad server's data_dir (the directory containing server/raft/) — e.g. nomad server data_dir or its default /var/lib/nomad.","Verify the path exists and list it: ls <p>/server/raft — you should see raft.db or wal/; adjust the path if not.","If you have a direct store file, pass its full path ending in .db (accepted as a direct raft.db path) or the wal/ directory itself.","Restore the server data directory from backup before running inspection/FSM tooling if the store was deleted.","If using FindRaftFile with an old layout, confirm the backend: WAL deployments will never contain raft.db, so use FindRaftStore, not the raft.db-only wrapper."],"exampleFix":"// before: wrong path — agent config dir has no raft state\npath, err := raftutil.FindRaftStore(\"/etc/nomad.d\")\n// after: use the server data dir (or accept a direct .db path)\ndataDir := \"/var/lib/nomad\" // nomad agent's data_dir\npath, err := raftutil.FindRaftStore(dataDir)\nif err != nil {\n    // or: raftutil.FindRaftStore(filepath.Join(dataDir, \"server\", \"raft\", \"raft.db\"))\n    log.Fatalf(\"no raft store under %s: %v\", dataDir, err)\n}","handlingStrategy":"validation","validationCode":"func hasRaftStore(p string) bool {\n    for _, c := range []string{\n        filepath.Join(p, \"server\", \"raft\", \"wal\"),\n        filepath.Join(p, \"raft\", \"wal\"),\n        filepath.Join(p, \"wal\"),\n        filepath.Join(p, \"server\", \"raft\", \"raft.db\"),\n        filepath.Join(p, \"raft\", \"raft.db\"),\n        filepath.Join(p, \"raft.db\"),\n    } {\n        if _, err := os.Stat(c); err == nil { return true }\n    }\n    return false\n}\n// call hasRaftStore(dataDir) before FindRaftStore","typeGuard":null,"tryCatchPattern":"storePath, err := raftutil.FindRaftStore(dataDir)\nif err != nil {\n    if strings.Contains(err.Error(), \"no raft store\") {\n        return fmt.Errorf(\"%q is not a Nomad server data dir (no raft.db or wal/): %w\", dataDir, err)\n    }\n    return err\n}","preventionTips":["Always pass the Nomad server data_dir, not the config dir or client dir.","Check `ls <dataDir>/server/raft` before running recovery tooling.","Remember WAL deployments have no raft.db — use FindRaftStore, not FindRaftFile.","Keep backups of the server data dir before maintenance."],"tags":["raft","filesystem","paths","nomad"],"backgroundTag":"raft-store-not-found","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}