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.

Source

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

    }

    pub fn file_history_changed_files(
        &mut self,
        paths: Vec<RepoPath>,
        commit_limit: usize,
    ) -> oneshot::Receiver<Result<Vec<FileHistoryChangedFileSets>>> {
        self.send_job(
            "file_history_changed_files",
            None,
            move |git_repo, _cx| async move {
                match git_repo {
                    RepositoryState::Local(LocalRepositoryState { backend, .. }) => {
                        backend
                            .file_history_changed_files(paths, commit_limit)
                            .await
                    }
                    RepositoryState::Remote(_) => {
                        anyhow::bail!("file history changed files is only supported locally")
                    }
                }
            },
        )
    }

    pub fn get_graph_data(
        &self,
        log_source: LogSource,
        log_order: LogOrder,
    ) -> Option<&InitialGitGraphData> {
        self.initial_graph_data.get(&(log_source, log_order))
    }

    pub fn search_commits(
        &mut self,
        log_source: LogSource,
        search_args: SearchCommitArgs,

View on GitHub (pinned to f4178619ac)

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@f4178619ac (2026-08-20). Data as JSON: /api/errors/763b6f317049400a. Report an issue: GitHub.