zed-industries/zed · error · anyhow::Error

file history changed files is only supported locally

Error message

file history changed files is only supported locally

What it means

Zed's GitStore executes the file_history_changed_files job against the local git backend only (crates/project/src/git_store.rs:7036). In remote development sessions the repository is a RepositoryState::Remote, which has no local backend to compute changed-file sets from, so the job fails immediately rather than returning incorrect history.

Solutions

  1. Guard the call: only invoke file_history_changed_files when the worktree is local (worktree.read(cx).is_local())
  2. Hide or disable the file-history UI entry point for remote repositories, like other local-only git operations
  3. For remote hosts, run the equivalent git command outside Zed on the remote machine

Example fix

// before
let sets = git_store.file_history_changed_files(paths, commit_limit, cx).await?;

// after
if worktree.read(cx).is_local() {
    let sets = git_store.file_history_changed_files(paths, commit_limit, cx).await?;
}
Defensive patterns

Strategy: validation

Validate before calling

let is_local = worktree.read(cx).is_local();
if !is_local {
    // Skip: local-only git operation on a remote repository
    return Ok(Vec::new());
}

Type guard

fn is_local_repository(worktree: &Entity<Worktree>, cx: &App) -> bool {
    worktree.read(cx).is_local()
}

Try / catch

match git_store.file_history_changed_files(paths, commit_limit, cx).await {
    Ok(sets) => { /* ... */ }
    Err(err) if err.to_string().contains("only supported locally") => {
        // degrade gracefully in remote sessions instead of propagating
    }
    Err(err) => return Err(err),
}

Prevention

When it happens

Trigger: Calling GitStore::file_history_changed_files(paths, commit_limit) while the project's repository state is RepositoryState::Remote - i.e. invoking the file-history changed-files feature, or any extension wrapping it, inside an SSH/remote development session.

Common situations: Remote (SSH) projects where the worktree lives on the remote host; extensions or custom tooling written against local-only git APIs; local-git code paths reused in remote sessions.

Related errors


AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-08-20). Data as JSON: /api/errors/763b6f317049400a. Report an issue: GitHub.

Appendix: source

Thrown at crates/project/src/git_store.rs:7050

        cx.spawn(|_, _: &mut AsyncApp| async move { rx.await? })
    }

    fn open_local_commit_buffer(
        language_registry: Option<Arc<LanguageRegistry>>,
        buffer_store: Entity<BufferStore>,
        cx: &mut Context<Self>,
    ) -> Task<Result<Entity<Buffer>>> {
        cx.spawn(async move |repository, cx| {
            let git_commit_language = match language_registry {
                Some(language_registry) => {
                    Some(language_registry.language_for_name("Git Commit").await?)
                }
                None => None,
            };
            let buffer = buffer_store
                .update(cx, |buffer_store, cx| {
                    buffer_store.create_buffer(git_commit_language, false, cx)
                })
                .await?;

            repository.update(cx, |repository, _| {
                repository.commit_message_buffer = Some(buffer.clone());
            })?;
            Ok(buffer)
        })
    }

    pub fn checkout_files(
        &mut self,
        commit: &str,
        paths: Vec<RepoPath>,
        cx: &mut Context<Self>,
    ) -> Task<Result<()>> {
        let commit = commit.to_string();
        let id = self.id;

View on GitHub (pinned to 916fc2b8cb)