zed-industries/zed · error
Failed to {operation} `{from_name}` to `{to_name}`. A file o
Error message
Failed to {operation} `{from_name}` to `{to_name}`. A file or folder already exists there. What it means
A rename/move undo or redo failed because the underlying FS rename returned an 'already exists' error (destination occupied), detected by scanning the error chain for an AlreadyExists io error or 'already exists' text.
Source
Thrown at crates/project_panel/src/undo.rs:681
format!("Failed to {operation} `{from_name}`. It no longer exists.")
})?;
Ok(project.rename_entry(entry_id, to.clone(), cx))
})
});
res?.await.map_err(|err| {
// It is possible for `RealFs::rename` to return an error other than
// `io::Error` when the file already exists, hence why we're also
// checking if the error contains the "already exists" string.
let already_exists = err.chain().any(|cause| {
cause
.downcast_ref::<std::io::Error>()
.is_some_and(|io_err| io_err.kind() == std::io::ErrorKind::AlreadyExists)
}) || format!("{err:#}").contains("already exists");
if already_exists {
anyhow!(
"Failed to {operation} `{from_name}` to `{to_name}`. A file or folder already exists there."
)
} else {
err
}
})
}
/// Creates an empty directory at `path`, doing nothing if it already
/// exists.
async fn create_dir(&self, path: &ProjectPath, cx: &mut AsyncApp) -> Result<()> {
let Some(workspace) = self.workspace.upgrade() else {
return Err(anyhow!("Failed to obtain workspace."));
};
let task = workspace.update(cx, |workspace, cx| {
workspace.project().update(cx, |project, cx| {
if project.entry_for_path(path, cx).is_some() {View on GitHub (pinned to f4178619ac)
Solutions
- Remove or rename the conflicting file at the destination
- Undo the conflicting creation first
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/project_panel/src/undo.rs:681 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/d7b264aee7e5581d.
Report an issue: GitHub.