zed-industries/zed · error · anyhow::Error
cannot open repository on disconnected remote machine
Error message
cannot open repository on disconnected remote machine
What it means
Raised when opening an archived agent thread whose worktree lives on a remote (SSH) machine, but the pooled connection to that machine is no longer active. The code explicitly re-checks `remote::has_active_connection` before reusing the SSH transport from the connection pool; if the SSH session dropped, it refuses to build the temporary remote project.
Solutions
- Reconnect to the remote host first (reopen the remote project / SSH panel) and wait for it to be active, then open the archived thread.
- Verify the SSH host is reachable (`ssh <host>` in a terminal) and credentials/agent forwarding still work.
- If the remote is gone for good, open the thread on a local copy of the worktree instead of the remote paths.
- In code driving this path, check `remote::has_active_connection` before attempting the open and surface a reconnect prompt.
Example fix
// before: assume the pooled connection is still usable
cx.update(|cx| remote_connection::connect_reusing_pool(connection, cx))?.await?;
// after: verify liveness first and fail with an actionable message
if !remote::has_active_connection(&connection, cx) {
prompt_user_to_reconnect(&connection);
return Ok(None);
}
cx.update(|cx| remote_connection::connect_reusing_pool(connection, cx))?.await?; Defensive patterns
Strategy: retry
Validate before calling
// Before opening a remote-path thread archive:
let active = cx.update(|cx| remote::has_active_connection(&connection, cx));
if !active {
// prompt reconnect instead of calling open
} Try / catch
match open_archived_thread(&archive, cx).await {
Err(err) if err.to_string().contains("disconnected remote machine") => {
reconnect_remote(&connection).await?; // then retry once
open_archived_thread(&archive, cx).await
}
result => result,
} Prevention
- Check `remote::has_active_connection` before any pooled-connection reuse.
- Prompt the user to reconnect SSH when resuming threads that reference remote paths.
- Keep local mirrors of important remote worktrees if archives must open offline.
When it happens
Trigger: Opening a thread worktree archive (resuming/restoring an old thread) that references remote paths, while the SSH connection it was created over has since closed: network change, SSH timeout, remote host reboot, or Zed restarted without reconnecting.
Common situations: Resuming old threads after sleep/hibernate or switching networks; SSH keepalive timeout on idle connections; remote host unreachable (rebooted, DNS changed); opening archives from another machine.
Related errors
- aborting reconnect, because not in state that allows…
- build ids may only contain lowercase letters, numbers, '.'…
- Prebuilt remote servers are not yet available for
- Prebuilt remote servers are not yet available for
- registry dataset requires a name
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/bb6867347af204b7.
Report an issue: GitHub.
Appendix: source
Thrown at crates/agent_ui/src/thread_worktree_archive.rs:410
.next()
});
if let Some((repo, project)) = live_repo {
return Ok((repo, project));
}
let app_state =
current_app_state(cx).context("no app state available for temporary project")?;
// For remote paths, create a fresh RemoteClient through the connection
// pool (reusing the existing SSH transport) and build a temporary
// remote project. Each RemoteClient gets its own server-side headless
// project, so there are no RPC routing conflicts with other projects.
let temp_project = if let Some(connection) = remote_connection_owned {
let remote_client = cx
.update(|cx| {
if !remote::has_active_connection(&connection, cx) {
anyhow::bail!("cannot open repository on disconnected remote machine");
}
Ok(remote_connection::connect_reusing_pool(connection, cx))
})?
.await?
.context("remote connection was canceled")?;
cx.update(|cx| {
Project::remote(
remote_client,
app_state.client.clone(),
app_state.node_runtime.clone(),
app_state.user_store.clone(),
app_state.languages.clone(),
app_state.fs.clone(),
false,
cx,
)
})View on GitHub (pinned to f4178619ac)