{"record":{"id":"d22c15733b0a2fca","repo":"rustfs/rustfs","slug":"rename-base-directory-contains-an-invalid-path-com","errorCode":null,"errorMessage":"rename base directory contains an invalid path component","messagePattern":"rename base directory contains an invalid path component","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/ecstore/src/disk/os.rs","lineNumber":3796,"sourceCode":"    {\n        use windows_sys::Wdk::Storage::FileSystem::{FILE_OPEN, FILE_OPEN_IF};\n        use windows_sys::Win32::Storage::FileSystem::{FILE_SHARE_READ, FILE_SHARE_WRITE};\n\n        let base_relative = publication_root.relative_path(base_dir)?;\n        let capacity = base_relative\n            .components()\n            .count()\n            .saturating_add(relative.components().count())\n            .saturating_add(1);\n        let mut handles = Vec::with_capacity(capacity);\n        handles.push(publication_root.directory.clone());\n        let mut guard = ExistingBaseDirectoryGuard::new(handles);\n        for component in base_relative.components() {\n            let Component::Normal(component) = component else {\n                if matches!(component, Component::CurDir) {\n                    continue;\n                }\n                return Err(io::Error::new(\n                    io::ErrorKind::InvalidInput,\n                    \"rename base directory contains an invalid path component\",\n                ));\n            };\n            let parent = guard\n                .handles\n                .last()\n                .ok_or_else(|| io::Error::other(\"Windows publication root guard is empty\"))?;\n            let child = open_windows_directory_component(parent, component, FILE_OPEN)?;\n            guard.handles.push(child);\n        }\n        for component in relative.components() {\n            let Component::Normal(component) = component else {\n                continue;\n            };\n            let parent = guard\n                .handles\n                .last()","sourceCodeStart":3778,"sourceCodeEnd":3814,"githubUrl":"https://github.com/rustfs/rustfs/blob/201c653dcd34c2a01b9aec5991ed76176b342118/crates/ecstore/src/disk/os.rs#L3778-L3814","documentation":"On the Windows guard-construction path, a component of base_dir relative to the publication root is neither Normal nor CurDir — a ParentDir, root, or prefix component. The handle chain can only be built through real named directories, so the call fails with InvalidInput before opening anything.","triggerScenarios":"base_dir itself contains dot-dot after being made relative to the publication root, or was built from mixed absolute/relative segments.","commonSituations":"Config-provided base paths with trailing dot-dot or prefix components (C:) surviving normalization; refactors that changed how the base is derived from the publication root.","solutions":["Normalize base_dir so it is a plain sequence of Normal components under the publication root","Validate config paths at startup and reject dot-dot segments","Log the offending component when the error fires to pinpoint the config source"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn base_has_only_normal_components(base: &std::path::Path, root: &std::path::Path) -> bool {\n    match base.strip_prefix(root) {\n        Ok(rel) => rel.components().all(|c| matches!(c, std::path::Component::Normal(_) | std::path::Component::CurDir)),\n        Err(_) => false,\n    }\n}","typeGuard":null,"tryCatchPattern":"Err(err) if err.kind() == io::ErrorKind::InvalidInput && err.to_string().contains(\"base directory contains an invalid path component\") => fail startup or request with the offending base path; configuration fix required","preventionTips":["Validate configured base paths at startup","Reject dot-dot segments in any path destined for the guarded tree"],"tags":["windows","path-validation","invalid-input","mkdir"],"backgroundTag":"invalid-path-component","analyzedSha":"201c653dcd34c2a01b9aec5991ed76176b342118","analyzedAt":"2026-08-20T21:57:04.799Z","contentChangedAt":"2026-08-20T21:57:04.799Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}