{"record":{"id":"5262ac87097d017a","repo":"dmtrKovalenko/fff","slug":"failed-to-canonicalize-path","errorCode":null,"errorMessage":"Failed to canonicalize path: {}","messagePattern":"Failed to canonicalize path: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/fff-c/src/lib.rs","lineNumber":1084,"sourceCode":") -> *mut FffResult {\n    let inst = match unsafe { instance_ref(fff_handle) } {\n        Ok(i) => i,\n        Err(e) => return e,\n    };\n\n    let query_str = match unsafe { cstr_to_str(query) } {\n        Some(s) => s,\n        None => return FffResult::err(\"Query is null or invalid UTF-8\"),\n    };\n\n    let path_str = match unsafe { cstr_to_str(file_path) } {\n        Some(s) => s,\n        None => return FffResult::err(\"File path is null or invalid UTF-8\"),\n    };\n\n    let file_path = match fff::path_utils::canonicalize(path_str) {\n        Ok(p) => p,\n        Err(e) => return FffResult::err(&format!(\"Failed to canonicalize path: {}\", e)),\n    };\n\n    let project_path = {\n        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","sourceCodeStart":1066,"sourceCodeEnd":1102,"githubUrl":"https://github.com/dmtrKovalenko/fff/blob/7f8537e70f0ea1210f9acbbfc4640141105cdc78/crates/fff-c/src/lib.rs#L1066-L1102","documentation":"fff_track_query canonicalizes the provided file path via fff::path_utils::canonicalize; if canonicalization fails (path does not exist, permission denied, or symlink loop), the error is wrapped and returned. Query history records canonical paths, so unresolvable paths are rejected.","triggerScenarios":"Calling fff_track_query with a path that does not exist on disk, was deleted between selection and tracking, is unreadable due to permissions, or contains an unresolvable symlink chain.","commonSituations":"Tracking a query for a file that was closed and deleted in the meantime; passing a relative or virtual path (e.g. a scratch buffer name like '[No Name]') instead of a real file; running in a container where the original path mount is gone.","solutions":["Check that the file exists (and is readable) before calling fff_track_query.","Pass an absolute, real filesystem path — not buffer names or virtual paths.","Ignore this error in the host app: tracking is best-effort and non-critical.","Refresh the path from the editor's buffer state in case the file moved."],"exampleFix":"// before\nfff_track_query(inst, q, c\"~/notes.md\"); // tilde not expanded, canonicalize fails\n// after\nlet abs = expanduser(\"~/notes.md\");\nif std::path::Path::new(&abs).exists() { fff_track_query(inst, q, abs); }","handlingStrategy":"fallback","validationCode":"if vim.fn.filereadable(path) == 0 then return end\npath = vim.fn.fnamemodify(path, ':p')","typeGuard":null,"tryCatchPattern":"local res = fff.track_query(inst, q, path)\nif res.is_err then log('track skipped: path not canonicalizable') end -- best-effort","preventionTips":["Expand and absolutize paths (vim.fn.fnamemodify(p, ':p')) before tracking.","Never pass virtual buffer names like '[No Name]'.","Treat query tracking as best-effort; never surface this error to users."],"tags":["ffi","filesystem","path","validation"],"backgroundTag":"file-not-found","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"}