{"record":{"id":"9729084f5c583a91","repo":"lsd-rs/lsd","slug":"invalid-file-name","errorCode":null,"errorMessage":"invalid file name","messagePattern":"invalid file name","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"src/meta/mod.rs","lineNumber":125,"sourceCode":"            )?;\n            \"..\".clone_into(&mut parent_meta.name.name);\n\n            current_meta.git_status = cache.and_then(|cache| cache.get(&current_meta.path, true));\n            parent_meta.git_status = cache.and_then(|cache| cache.get(&parent_meta.path, true));\n\n            content.push(current_meta);\n            content.push(parent_meta);\n        }\n\n        let mut exit_code = ExitCode::OK;\n\n        for entry in entries {\n            let entry = entry?;\n            let path = entry.path();\n\n            let name = path\n                .file_name()\n                .ok_or_else(|| Error::new(ErrorKind::InvalidInput, \"invalid file name\"))?;\n\n            if flags.ignore_globs.0.is_match(name) {\n                continue;\n            }\n\n            #[cfg(windows)]\n            let is_hidden =\n                name.to_string_lossy().starts_with('.') || windows_utils::is_path_hidden(&path);\n            #[cfg(not(windows))]\n            let is_hidden = name.to_string_lossy().starts_with('.');\n\n            #[cfg(windows)]\n            let is_system = windows_utils::is_path_system(&path);\n            #[cfg(not(windows))]\n            let is_system = false;\n\n            match flags.display {\n                // show hidden files, but ignore system protected files","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/lsd-rs/lsd/blob/4b6c14a110fe0fd544ec0204501b5fd3a5d6218f/src/meta/mod.rs#L107-L143","documentation":"recurse_into walks a directory and calls Path::file_name() on each entry's path. When a path ends in '..' or is a bare root with no final component, file_name() returns None, and this InvalidInput io::Error is produced instead of a usable entry name. It indicates a malformed or degenerate directory entry encountered during recursion, not a user-facing listing problem.","triggerScenarios":"Calling recursion/listing APIs (which enter recurse_into) over a directory whose entries include paths lacking a final component — e.g. paths constructed as \"dir/..\" or root paths like \"/\" or \"C:\\\" fed back into the walker, or a directory entry whose OsStr cannot yield a file_name.","commonSituations":"Recursing into mount points or symlink loops that resolve to '/' or '..'; pointing eza at the filesystem root; custom VFS/FUSE mounts yielding odd entries; scripting that passes paths ending in '/..' into a recursive listing.","solutions":["Check the path you are recursing into: avoid passing paths ending in '..' or bare roots ('/') to the walker.","Skip or normalize degenerate paths before recursion (e.g. canonicalize, or use entry.file_name()/entry.path().file_name on the DirEntry rather than re-derived paths).","Handle the io::Error at the call site and continue with the remaining entries instead of aborting the whole listing.","If it reproduces on ordinary directories, verify the filesystem/mount is not returning malformed entries (dmesg, fsck)."],"exampleFix":"// before\nrecurse_into(\"/some/dir/..\")?; // panics/errors: file_name() == None\n// after\nlet path = fs::canonicalize(\"/some/dir/..\")?; // normalizes '..'\nrecurse_into(&path)?;","handlingStrategy":"validation","validationCode":"fn has_file_name(p: &std::path::Path) -> bool {\n    p.file_name().is_some() // false for \"/\", \"dir/..\"\n}\n// before recursing: if !has_file_name(&path) { skip }","typeGuard":"fn safe_file_name(p: &std::path::Path) -> Option<&std::ffi::OsStr> {\n    p.file_name()\n}","tryCatchPattern":"match walker_result {\n    Ok(entries) => /* use entries */,\n    Err(e) if e.kind() == std::io::ErrorKind::InvalidInput => /* skip path, continue */,\n    Err(e) => return Err(e),\n}","preventionTips":["Normalize paths with canonicalize() before passing them to recursive walkers.","Never pass paths ending in '..' or bare roots ('/') into directory recursion.","Prefer entry.file_name()/DirEntry-derived names over re-deriving from joined paths.","Filter out root and parent components early in custom walkers."],"tags":["filesystem","path-handling","io-error","recursion"],"backgroundTag":"invalid-path-component","analyzedSha":"4b6c14a110fe0fd544ec0204501b5fd3a5d6218f","analyzedAt":"2026-09-04T20:04:26.847Z","contentChangedAt":"2026-09-04T20:04:26.847Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}