{"record":{"id":"92b40e050451a9a9","repo":"dmtrKovalenko/fff","slug":"failed-to-init-query-tracker-db","errorCode":null,"errorMessage":"Failed to init query tracker db: {}","messagePattern":"Failed to init query tracker db: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/fff-c/src/lib.rs","lineNumber":240,"sourceCode":"                    return FffResult::err(&format!(\"Failed to acquire frecency lock: {}\", e));\n                }\n            }\n            Err(e) => return FffResult::err(&format!(\"Failed to init frecency db: {}\", e)),\n        }\n    }\n\n    if let Some(ref history_path) = history_path {\n        if let Some(parent) = PathBuf::from(history_path).parent() {\n            let _ = std::fs::create_dir_all(parent);\n        }\n\n        match QueryTracker::open(history_path) {\n            Ok(tracker) => {\n                if let Err(e) = query_tracker.init(tracker) {\n                    return FffResult::err(&format!(\"Failed to acquire query tracker lock: {}\", e));\n                }\n            }\n            Err(e) => return FffResult::err(&format!(\"Failed to init query tracker db: {}\", e)),\n        }\n    }\n\n    let mode = if opts.ai_mode {\n        FFFMode::Ai\n    } else {\n        FFFMode::Neovim\n    };\n\n    let cache_budget = fff::ContentCacheBudget::from_overrides(\n        opts.cache_budget_max_files as usize,\n        opts.cache_budget_max_bytes,\n        opts.cache_budget_max_file_size,\n    );\n\n    if let Err(e) = FilePicker::new_with_shared_state(\n        shared_picker.clone(),\n        shared_frecency.clone(),","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/dmtrKovalenko/fff/blob/7f8537e70f0ea1210f9acbbfc4640141105cdc78/crates/fff-c/src/lib.rs#L222-L258","documentation":"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.","triggerScenarios":"history_db_path in an unwritable or non-existent location; corrupted/locked LMDB files; disk full; invalid path characters on the platform.","commonSituations":"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.","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."],"exampleFix":"// before\nopts.history_db_path = \"/mnt/ro-vol/fff/history\";\n// after\nopts.history_db_path = \"/home/me/.cache/fff/history\";","handlingStrategy":"fallback","validationCode":"const fs = require('fs');\nif (historyPath) { fs.mkdirSync(path.dirname(historyPath), { recursive: true }); fs.accessSync(path.dirname(historyPath), fs.constants.W_OK); }","typeGuard":null,"tryCatchPattern":"try {\n  createInstance({ ...opts, history_db_path: p });\n} catch (e) {\n  if (/Failed to init query tracker db/.test(e.message)) {\n    fs.rmSync(p, { recursive: true, force: true }); // drop corrupt history db\n    return createInstance({ ...opts, history_db_path: p });\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["lmdb","database","rust","file-io"],"backgroundTag":"database-query-failed","analyzedSha":"7f8537e70f0ea1210f9acbbfc4640141105cdc78","analyzedAt":"2026-09-10T07:26:53.407Z","contentChangedAt":"2026-09-10T07:26:53.407Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}