zed-industries/zed · error

No git repositories found in the project

Error message

No git repositories found in the project

What it means

Guard in create_worktree_workspace_inner: classify_paths found no git repositories (and only non-git content) in the project, so there is no repository in which a worktree can be created. A toast is shown alongside the returned error.

Source

Thrown at crates/git_ui_core/src/worktree_service.rs:798

    // `detach_and_log_err`, matching the pre-existing silent return.
    if workspace.active_worktree_creation().label.is_some() {
        return Task::ready(Err(anyhow!("A worktree creation is already in progress")));
    }

    let previous_state =
        workspace.capture_state_for_worktree_switch(window, fallback_focused_dock, cx);
    let workspace_handle = workspace.weak_handle();
    let window_handle = window.window_handle().downcast::<MultiWorkspace>();
    let remote_connection_options = project.read(cx).remote_connection_options(cx);

    let (git_repos, non_git_paths) = classify_worktrees(project.read(cx), cx);

    if git_repos.is_empty() {
        let toast_workspace = cx.entity();
        show_error_toast(
            toast_workspace,
            "worktree create",
            anyhow!("No git repositories found in the project"),
            cx,
        );
        return Task::ready(Err(anyhow!("No git repositories found in the project")));
    }

    if remote_connection_options.is_some() {
        let is_disconnected = project
            .read(cx)
            .remote_client()
            .is_some_and(|client| client.read(cx).is_disconnected());
        if is_disconnected {
            let toast_workspace = cx.entity();
            show_error_toast(
                toast_workspace,
                "worktree create",
                anyhow!("Cannot create worktree: remote connection is not active"),
                cx,
            );

View on GitHub (pinned to f4178619ac)

Solutions

  1. Open a folder that is a git repository (contains a .git directory)
  2. Initialize one with `git init` in the project root, then reload the project
  3. If the repo is in a subdirectory, ensure worktrees are scanned/registered by reopening that folder
  4. For monorepos, verify the repository root is the opened workspace root or a registered worktree
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/git_ui_core/src/worktree_service.rs:798 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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