zed-industries/zed · error

git repo must have a directory name

Error message

git repo must have a directory name

What it means

Raised while computing a directory for a new git linked worktree: the repository anchor path (main worktree path or common dir) has no final path component, so no name can be derived for the new worktree directory.

Solutions

  1. Ensure the main worktree / common dir path is a normal absolute path with a file name
  2. Check that the git repository metadata isn't corrupted
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/project/src/git_store.rs:8912 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

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

        self.send_keyed_job(
            "spawn_set_index_text_job",
            Some(GitJobKey::WriteIndex(vec![path.clone()])),
            None,
            move |git_repo, mut cx| async move {
                log::debug!(
                    "start updating index text for buffer {}",
                    path.as_unix_str()
                );

                match git_repo {
                    RepositoryState::Local(LocalRepositoryState {
                        fs,
                        backend,
                        environment,
                        ..
                    }) => {
                        let executable = match fs.metadata(&abs_path).await {
                            Ok(Some(meta)) => meta.is_executable,
                            Ok(None) => false,
                            Err(_err) => false,
                        };
                        let content =
                            content.map(|content| encode_text(content, encoding, has_bom));
                        backend
                            .set_index_text(path.clone(), content, environment.clone(), executable)
                            .await?;
                    }
                    RepositoryState::Remote(RemoteRepositoryState { project_id, client }) => {
                        client
                            .request(proto::SetIndexText {
                                project_id: project_id.0,
                                repository_id: id.to_proto(),
                                path: path.as_unix_str().to_owned(),
                                text: content,
                            })
                            .await?;

View on GitHub (pinned to 916fc2b8cb)