{"record":{"id":"8055c74701b7ea06","repo":"zed-industries/zed","slug":"temporary-repository-barrier-canceled","errorCode":null,"errorMessage":"temporary repository barrier canceled","messagePattern":"temporary repository barrier canceled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_ui/src/thread_worktree_archive.rs","lineNumber":469,"sourceCode":"\n    let repo_path_for_find = repo_path.to_path_buf();\n    let repo = temp_project\n        .update(cx, |project, cx| {\n            project\n                .repositories(cx)\n                .values()\n                .find(|repo| {\n                    repo.read(cx).snapshot().work_directory_abs_path.as_ref()\n                        == repo_path_for_find.as_path()\n                })\n                .cloned()\n        })\n        .context(\"failed to resolve temporary repository handle\")?;\n\n    let barrier = repo.update(cx, |repo: &mut Repository, _cx| repo.barrier());\n    barrier\n        .await\n        .map_err(|_| anyhow!(\"temporary repository barrier canceled\"))?;\n    Ok((repo, temp_project))\n}\n\n/// Re-adds the worktree to every affected project after a failed\n/// [`remove_root`].\nasync fn rollback_root(root: &RootPlan, cx: &mut AsyncApp) {\n    for affected in &root.affected_projects {\n        let task = affected.project.update(cx, |project, cx| {\n            project.create_worktree(root.root_path.clone(), true, cx)\n        });\n        task.await.log_err();\n    }\n}\n\n/// Saves the worktree's full git state so it can be restored later.\n///\n/// This creates two detached commits (via [`create_archive_checkpoint`] on\n/// the `GitRepository` trait) that capture the staged and unstaged state","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/agent_ui/src/thread_worktree_archive.rs#L451-L487","documentation":"While setting up the temporary repository for worktree archival/restore, awaiting repo.barrier() was cancelled (future dropped), meaning the git barrier that serializes repository access did not complete.","triggerScenarios":"Thrown at crates/agent_ui/src/thread_worktree_archive.rs:469 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the operation once the temporary project's repository finishes replaying its git events and the barrier resolves","Ensure the temporary project (and its Repository entity) is not dropped or torn down while the barrier is pending","If cancellation is expected during shutdown, propagate it as a clean abort rather than surfacing it as a failure"],"exampleFix":null,"handlingStrategy":"retry","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-23T08:17:48.524Z"}