{"record":{"id":"4dab99dd254a1d20","repo":"nikivdev/code","slug":"path-not-found","errorCode":null,"errorMessage":"Path not found: {}","messagePattern":"Path not found: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/ext.rs","lineNumber":136,"sourceCode":"    Ok(())\n}\n\nfn disable_extension(name: &str) -> Result<()> {\n    flow_config::disable_extension(name)?;\n    println!(\"Disabled extension {}\", name);\n    Ok(())\n}\n\nfn init_extension(name: &str, force: bool) -> Result<()> {\n    let dir = flow_config::init_extension(name, force)?;\n    println!(\"Initialized extension {} at {}\", name, dir.display());\n    Ok(())\n}\n\nfn import_external_path(path: &str) -> Result<()> {\n    let source = normalize_path(path)?;\n    if !source.exists() {\n        bail!(\"Path not found: {}\", source.display());\n    }\n    if !source.is_dir() {\n        bail!(\"Path must be a directory: {}\", source.display());\n    }\n\n    let project_root = project_root_from_cwd();\n    let ext_dir = project_root.join(\"ext\");\n    fs::create_dir_all(&ext_dir)?;\n\n    let name = source\n        .file_name()\n        .and_then(|n| n.to_str())\n        .map(|s| s.to_string())\n        .filter(|s| !s.trim().is_empty())\n        .unwrap_or_else(|| \"external\".to_string());\n\n    let dest = ext_dir.join(&name);\n    if dest.exists() {","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/ext.rs#L118-L154","documentation":"`import_external_path` normalizes the given path and bails if it does not exist on disk. Importing an extension requires an existing directory; this is the first guard before further validation (directory check, project root resolution).","triggerScenarios":"Calling `f ext import <path>` (or the bare-path form) where `source.exists()` is false after normalization — relative path wrong relative to cwd, or the directory was deleted/renamed.","commonSituations":"Typo in the path or wrong working directory; extension folder renamed during refactoring; path given relative to a different directory than the shell's cwd; trailing-slash or symlink issues after normalize_path; trying to import a path from another repo that hasn't been cloned.","solutions":["Check the path exists: ls <path> from the same directory you run f in","Use an absolute path to rule out cwd confusion: f ext import /abs/path/to/ext","Verify the extension directory name after any rename (check the source repo's extensions folder)","Clone or restore the extension directory if it lives in another repository","Note the next guard: even if it exists, it must be a directory, not a file"],"exampleFix":"// before\nf ext import ./extenstions/my-ext   # typo, Path not found\n// after\nf ext import ./extensions/my-ext    # correct directory","handlingStrategy":"validation","validationCode":"// verify the import target before running the command\nlet target = std::path::Path::new(\"./extensions/my-ext\");\nlet abs = std::fs::canonicalize(target).unwrap_or_else(|_| target.to_path_buf());\nif !abs.is_dir() {\n    bail!(\"import target does not exist or is not a directory: {}\", abs.display());\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().starts_with(\"Path not found\") => {\n        eprintln!(\"{e}; check the path and your working directory\");\n    }\n    other => other?,\n}","preventionTips":["Use absolute paths in scripts to avoid cwd confusion","Tab-complete the path in the shell to catch typos","Confirm the extension directory name after renames/refactors","Remember the target must be a directory, not a single file"],"tags":["filesystem","path","cli","import"],"backgroundTag":"file-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}