dmtrKovalenko/fff · error
Failed to init query tracker db
Error message
Failed to init query tracker db: {} What it means
QueryTracker::open failed to open or create the LMDB query history database at history_db_path, with the underlying LMDB error embedded in the message. The query history db records previous searches, so without it instance creation fails when history is requested.
Solutions
- Verify the history_db_path directory exists and is writable.
- Remove corrupted LMDB files (data.mdb/lock.mdb) at that path; history is rebuildable.
- Ensure no other process holds an exclusive LMDB lock on the same path.
- Choose a different, writable history_db_path to confirm the cause.
- Free disk space if the disk is full.
Example fix
// before opts.history_db_path = "/mnt/ro-vol/fff/history"; // after opts.history_db_path = "/home/me/.cache/fff/history";
Defensive patterns
Strategy: fallback
Validate before calling
const fs = require('fs');
if (historyPath) { fs.mkdirSync(path.dirname(historyPath), { recursive: true }); fs.accessSync(path.dirname(historyPath), fs.constants.W_OK); } Try / catch
try {
createInstance({ ...opts, history_db_path: p });
} catch (e) {
if (/Failed to init query tracker db/.test(e.message)) {
fs.rmSync(p, { recursive: true, force: true }); // drop corrupt history db
return createInstance({ ...opts, history_db_path: p });
}
throw e;
} Prevention
- Store history in a writable user cache directory.
- Avoid sharing a single history path across processes or versions.
- Recreate the db freely on corruption; it is non-critical data.
- Check for lock holders and disk space before blaming permissions.
When it happens
Trigger: history_db_path in an unwritable or non-existent location; corrupted/locked LMDB files; disk full; invalid path characters on the platform.
Common situations: Read-only cache dirs in CI/containers; corrupted db after an abrupt kill; two apps sharing one history path with incompatible versions; permission errors after user change.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Failed to init frecency db
- Failed to init tracing
- Failed to track query
- Failed to get historical query
- Instance handle is null. Create one with…
AI-assisted analysis of dmtrKovalenko/fff@7f8537e70f (2026-09-10).
Data as JSON: /api/errors/92b40e050451a9a9.
Report an issue: GitHub.
Appendix: source
Thrown at crates/fff-c/src/lib.rs:240
return FffResult::err(&format!("Failed to acquire frecency lock: {}", e));
}
}
Err(e) => return FffResult::err(&format!("Failed to init frecency db: {}", e)),
}
}
if let Some(ref history_path) = history_path {
if let Some(parent) = PathBuf::from(history_path).parent() {
let _ = std::fs::create_dir_all(parent);
}
match QueryTracker::open(history_path) {
Ok(tracker) => {
if let Err(e) = query_tracker.init(tracker) {
return FffResult::err(&format!("Failed to acquire query tracker lock: {}", e));
}
}
Err(e) => return FffResult::err(&format!("Failed to init query tracker db: {}", e)),
}
}
let mode = if opts.ai_mode {
FFFMode::Ai
} else {
FFFMode::Neovim
};
let cache_budget = fff::ContentCacheBudget::from_overrides(
opts.cache_budget_max_files as usize,
opts.cache_budget_max_bytes,
opts.cache_budget_max_file_size,
);
if let Err(e) = FilePicker::new_with_shared_state(
shared_picker.clone(),
shared_frecency.clone(),View on GitHub (pinned to 7f8537e70f)