zed-industries/zed · warning

restore_archive_checkpoint canceled

Error message

restore_archive_checkpoint canceled

What it means

After the worktree repository is available, the restore applies the archived staged/unstaged state via repo.restore_archive_checkpoint (git read-tree --reset -u plus a bare read-tree). This error means that operation's channel receiver was dropped before completion — teardown cancelled it; the caller then removes any newly created worktree and returns 'failed to restore archive checkpoint'.

Source

Thrown at crates/agent_ui/src/thread_worktree_archive.rs:785

                    );
                }
            }
        }
    }

    // Restore the staged/unstaged state from the WIP commit trees.
    // read-tree --reset -u applies the unstaged tree (including deletions)
    // to the working directory, then a bare read-tree sets the index to
    // the staged tree without touching the working directory.
    let restore_rx = wt_repo.update(cx, |repo, _cx| {
        repo.restore_archive_checkpoint(
            row.staged_commit_hash.clone(),
            row.unstaged_commit_hash.clone(),
        )
    });
    if let Err(error) = restore_rx
        .await
        .map_err(|_| anyhow!("restore_archive_checkpoint canceled"))
        .and_then(|r| r)
    {
        remove_new_worktree_on_error(created_new_worktree, &main_repo, worktree_path, cx).await;
        return Err(error.context("failed to restore archive checkpoint"));
    }

    if created_new_worktree {
        // Re-register the restored worktree as Zed-created so it can be
        // archived again later.
        git_ui_core::created_worktrees::record_created_worktree_for_repo(
            &wt_repo,
            worktree_path,
            remote_connection,
            cx,
        )
        .await;
    }

View on GitHub (pinned to bc538def45)

Solutions

  1. Retry the restore once the app/project is stable; the cleanup removed any half-created worktree.
  2. Keep the window open until 'Restoring thread…' completes.
  3. In code, treat cancellation as abort and make the error path (remove_new_worktree_on_error) idempotent.
Defensive patterns

Strategy: try-catch

Try / catch

match restore_rx.await {
    Ok(result) => result.context("failed to restore archive checkpoint")?,
    Err(_canceled) => {
        // checkpoint restore was cancelled by teardown;
        // run remove_new_worktree_on_error and abort
    }
}

Prevention

When it happens

Trigger: The window/project/repository entity is dropped while the checkpoint read-tree operations are running as part of unarchiving a thread.

Common situations: User closes Zed or the window during the final restore step; cancellation racing the spawned restore task.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/e963a3722cc92ee2. Report an issue: GitHub.