{"record":{"id":"d7b264aee7e5581d","repo":"zed-industries/zed","slug":"failed-to-operation-from-name-to-to-name","errorCode":null,"errorMessage":"Failed to {operation} `{from_name}` to `{to_name}`. A file or folder already exists there.","messagePattern":"Failed to (.+?) `(.+?)` to `(.+?)`\\. A file or folder already exists there\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/project_panel/src/undo.rs","lineNumber":681,"sourceCode":"                        format!(\"Failed to {operation} `{from_name}`. It no longer exists.\")\n                    })?;\n\n                Ok(project.rename_entry(entry_id, to.clone(), cx))\n            })\n        });\n\n        res?.await.map_err(|err| {\n            // It is possible for `RealFs::rename` to return an error other than\n            // `io::Error` when the file already exists, hence why we're also\n            // checking if the error contains the \"already exists\" string.\n            let already_exists = err.chain().any(|cause| {\n                cause\n                    .downcast_ref::<std::io::Error>()\n                    .is_some_and(|io_err| io_err.kind() == std::io::ErrorKind::AlreadyExists)\n            }) || format!(\"{err:#}\").contains(\"already exists\");\n\n            if already_exists {\n                anyhow!(\n                    \"Failed to {operation} `{from_name}` to `{to_name}`. A file or folder already exists there.\"\n                )\n            } else {\n                err\n            }\n        })\n    }\n\n    /// Creates an empty directory at `path`, doing nothing if it already\n    /// exists.\n    async fn create_dir(&self, path: &ProjectPath, cx: &mut AsyncApp) -> Result<()> {\n        let Some(workspace) = self.workspace.upgrade() else {\n            return Err(anyhow!(\"Failed to obtain workspace.\"));\n        };\n\n        let task = workspace.update(cx, |workspace, cx| {\n            workspace.project().update(cx, |project, cx| {\n                if project.entry_for_path(path, cx).is_some() {","sourceCodeStart":663,"sourceCodeEnd":699,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/project_panel/src/undo.rs#L663-L699","documentation":"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.","triggerScenarios":"Thrown at crates/project_panel/src/undo.rs:681 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove or rename the conflicting file at the destination","Undo the conflicting creation first"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}