{"record":{"id":"2949f7a700ddfed4","repo":"EpicGames/lore","slug":"unable-to-rename-file-directory-mismatch","errorCode":null,"errorMessage":"Unable to rename, file/directory mismatch","messagePattern":"Unable to rename, file/directory mismatch","errorType":"exception","errorClass":"tokio::io::Error (Unsupported)","httpStatus":null,"severity":"error","filePath":"lore-revision/src/util/fs.rs","lineNumber":830,"sourceCode":"    to_path: &'a Path,\n) -> Pin<Box<dyn Future<Output = std::io::Result<()>> + Send + 'a>> {\n    Box::pin(async move {\n        let driver = lore_io::IoDriver::global();\n        lore_debug!(\n            \"Try rename {} -> {}\",\n            from_path.display(),\n            to_path.display()\n        );\n        if driver.rename(from_path, to_path).await.is_ok() {\n            lore_debug!(\"Renamed {} -> {}\", from_path.display(), to_path.display());\n            return Ok(());\n        }\n\n        let from_metadata = driver.metadata(from_path).await?;\n        let to_metadata = driver.metadata(to_path).await?;\n\n        if from_metadata.is_dir() != to_metadata.is_dir() {\n            return Err(tokio::io::Error::new(\n                std::io::ErrorKind::Unsupported,\n                \"Unable to rename, file/directory mismatch\",\n            ));\n        }\n\n        if from_metadata.is_file() {\n            lore_debug!(\n                \"Failed rename {} -> {}, replacing\",\n                from_path.display(),\n                to_path.display()\n            );\n            driver.remove_file(to_path).await?;\n            if let Err(err) = driver.rename(from_path, to_path).await {\n                lore_debug!(\n                    \"Failed rename {} -> {}, try copy and delete: {err}\",\n                    from_path.display(),\n                    to_path.display(),\n                );","sourceCodeStart":812,"sourceCodeEnd":848,"githubUrl":"https://github.com/EpicGames/lore/blob/074eb0b0d1194c997d7cf28b55519e3e197b3e23/lore-revision/src/util/fs.rs#L812-L848","documentation":"`unify_name_case_rename` fixes a path's on-disk casing by renaming it. Before renaming it compares the dir/file kind of the source and destination metadata; if one is a directory and the other is not (or vice versa), it refuses with `ErrorKind::Unsupported`, because renaming between kinds would silently move different objects. This is a safety check against merging a file and a directory that share the same case-folded name.","triggerScenarios":"Calling `unify_name_case_rename` where the source path and target path resolve to entries of different kinds — e.g. source is a file but the target name collides with an existing directory (or the driver's metadata for either path points at a different object than expected on a case-insensitive filesystem).","commonSituations":"Case-insensitive filesystems (macOS/Windows default) where 'Foo.txt' and 'foo.txt' are the same entry, but one path is a dir and the other a file; stale plans generated before the entry's type changed.","solutions":["Inspect both paths' metadata; resolve the file/dir collision manually (delete or move one of the entries).","Recompute the rename plan after the collision is resolved.","Catch `ErrorKind::Unsupported` and skip/queue the entry for manual resolution instead of retrying."],"exampleFix":"// before\nunify_name_case_rename(from, to).await?;\n\n// after\nlet (f, t) = (metadata(from).await?, metadata(to).await?);\nif f.is_dir() != t.is_dir() {\n    eprintln!(\"kind mismatch between {from:?} and {to:?}; resolve manually\");\n} else {\n    unify_name_case_rename(from, to).await?;\n}","handlingStrategy":"validation","validationCode":"let from_meta = tokio::fs::metadata(&from_path).await?;\nlet to_meta = tokio::fs::metadata(&to_path).await?;\nif from_meta.is_dir() != to_meta.is_dir() {\n    // resolve the file/dir collision before renaming\n}","typeGuard":null,"tryCatchPattern":"match unify_name_case_rename(&from, &to).await {\n    Err(e) if e.kind() == io::ErrorKind::Unsupported => {\n        eprintln!(\"kind mismatch {from:?} <-> {to:?}; needs manual fix\");\n    }\n    other => other?,\n}","preventionTips":["Compare source/target metadata (is_dir) before any case-unifying rename.","On case-insensitive filesystems, expect folded-name collisions between files and dirs.","Regenerate rename plans after any change to entry types."],"tags":["filesystem","rename","case-sensitivity"],"backgroundTag":"incompatible-source-type","analyzedSha":"074eb0b0d1194c997d7cf28b55519e3e197b3e23","analyzedAt":"2026-09-13T09:00:57.509Z","contentChangedAt":"2026-09-13T09:00:57.509Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}