{"record":{"id":"21db44de50619f23","repo":"dmtrKovalenko/fff","slug":"failed-to-track-query","errorCode":null,"errorMessage":"Failed to track query: {}","messagePattern":"Failed to track query: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/fff-c/src/lib.rs","lineNumber":1106,"sourceCode":"        let guard = match inst.picker.read() {\n            Ok(g) => g,\n            Err(_) => return FffResult::ok_int(0),\n        };\n        match guard.as_ref() {\n            Some(p) => p.base_path().to_path_buf(),\n            None => return FffResult::ok_int(0),\n        }\n    };\n\n    let mut qt_guard = match inst.query_tracker.write() {\n        Ok(q) => q,\n        Err(_) => return FffResult::ok_int(0),\n    };\n\n    if let Some(ref mut tracker) = *qt_guard\n        && let Err(e) = tracker.track_query_completion(query_str, &project_path, &file_path)\n    {\n        return FffResult::err(&format!(\"Failed to track query: {}\", e));\n    }\n\n    FffResult::ok_int(1)\n}\n\n/// Get historical query by offset (0 = most recent).\n///\n/// ## Safety\n/// `fff_handle` must be a valid instance pointer from `fff_create_instance`.\n#[unsafe(no_mangle)]\npub unsafe extern \"C\" fn fff_get_historical_query(\n    fff_handle: *mut c_void,\n    offset: u64,\n) -> *mut FffResult {\n    let inst = match unsafe { instance_ref(fff_handle) } {\n        Ok(i) => i,\n        Err(e) => return e,\n    };","sourceCodeStart":1088,"sourceCodeEnd":1124,"githubUrl":"https://github.com/dmtrKovalenko/fff/blob/7f8537e70f0ea1210f9acbbfc4640141105cdc78/crates/fff-c/src/lib.rs#L1088-L1124","documentation":"fff_track_query calls QueryTracker::track_query_completion and wraps any internal database error (e.g. LMDB write failure) in this message. The call returns an error result with value 0 instead of the success value 1.","triggerScenarios":"Calling fff_track_query when the query tracker's underlying database cannot be written: disk full, LMDB map size exhausted, database file locked or corrupted, or I/O permission errors.","commonSituations":"Disk quota/full disk on the machine hosting the frecency DB; concurrent access corrupting or blocking the LMDB environment; read-only mount for the DB directory; very large query history hitting environment limits.","solutions":["Inspect the inner error payload to identify the database failure cause.","Check disk space and write permissions on the directory holding the query history DB.","Treat tracking as best-effort: log and continue, since losing one tracked query is harmless.","If the DB is corrupt or full, remove/rebuild the query history database files.","Retry the call once in case of a transient lock contention."],"exampleFix":"null","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"local res = fff.track_query(inst, q, path)\nif res.is_err then log('query tracking failed (non-critical): ' .. res.message) end","preventionTips":["Monitor disk space where the query history DB lives.","Keep the DB directory writable and on a non-read-only mount.","Design the host to tolerate lost tracking events."],"tags":["ffi","database","lmdb","write-failed"],"backgroundTag":"database-write-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"}