{"record":{"id":"02477d67aed58a7d","repo":"zed-industries/zed","slug":"failed-to-create-worktree-err","errorCode":null,"errorMessage":"Failed to create worktree: {err}","messagePattern":"Failed to create worktree: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git_ui_core/src/worktree_service.rs","lineNumber":626,"sourceCode":"                    fs::RemoveOptions {\n                        recursive: true,\n                        ignore_if_not_exists: true,\n                    },\n                )\n                .await\n            {\n                let msg = format!(\"{}: failed to remove directory: {fs_err}\", path.display());\n                log::error!(\"{}\", msg);\n                rollback_failures.push(msg);\n            }\n        }\n    }\n    let mut error_message = format!(\"Failed to create worktree: {err}\");\n    if !rollback_failures.is_empty() {\n        error_message.push_str(\"\\n\\nFailed to clean up: \");\n        error_message.push_str(&rollback_failures.join(\", \"));\n    }\n    Err(anyhow!(error_message))\n}\n\n/// Propagates worktree trust from the source workspace to the new workspace.\n/// If the source project's worktrees are all trusted, the new worktree paths\n/// will also be trusted automatically.\nfn maybe_propagate_worktree_trust(\n    source_workspace: &WeakEntity<Workspace>,\n    new_workspace: &Entity<Workspace>,\n    paths: &[PathBuf],\n    cx: &mut AsyncWindowContext,\n) {\n    cx.update(|_, cx| {\n        if ProjectSettings::get_global(cx).session.trust_all_worktrees {\n            return;\n        }\n        let source_is_trusted = source_workspace\n            .upgrade()\n            .map(|workspace| {","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/git_ui_core/src/worktree_service.rs#L608-L644","documentation":"Composite error from await_and_rollback_on_failure: worktree creation failed with err, and rollback attempted to delete partially created directories; any cleanup failures (fs_err) are appended under 'Failed to clean up', so the message reports both the root cause and leftover state.","triggerScenarios":"Thrown at crates/git_ui_core/src/worktree_service.rs:626 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the full error message — it appends any rollback/cleanup failures after 'Failed to clean up:'","Check disk space and filesystem permissions at the target path","Manually remove leftover directories listed in the cleanup failures, then retry","Re-run creation from the worktree picker after resolving the underlying `err`"],"exampleFix":null,"handlingStrategy":"try-catch","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"}