gitbutlerapp/gitbutler · error

Setup completed but project still not found at

Error message

Setup completed but project still not found at {}

What it means

In `init_ctx`, when the project was not found initially, the CLI runs legacy interactive setup, then retries `LegacyProject::find_by_worktree_dir`. If the project is still not registered after setup completed, this error is raised, meaning setup did not result in a persisted project record for the worktree.

Solutions

  1. Open the GitButler desktop app and add the folder as a project so it is registered, then retry the CLI command.
  2. Check that the directory you are running from matches the actual worktree path (avoid symlinked/relative paths).
  3. Inspect the app data/project store (e.g. ~/.local/share/gitbutler) for a stale or missing projects database entry and repair or reset it.
  4. Re-run setup in the foreground to see any swallowed setup error.

Example fix

// before
$ cd /var/symlink-to/myproject && but status
// after
$ cd /home/user/myproject   # real worktree path
but status
Defensive patterns

Strategy: retry

Validate before calling

const projects = gitbutler.listProjects();
if (!projects.some(p => fs.realpathSync(p.worktreeDir) === fs.realpathSync(cwd))) {
  console.warn('Project not registered; register via the GitButler app first');
}

Try / catch

match init_ctx() {
  Err(e) if e.to_string().contains("still not found") => {
    // fall back to interactive registration in the desktop app
    register_project_manually(workdir)?;
    init_ctx()
  }
  other => other,
}

Prevention

When it happens

Trigger: Setup prompt was accepted (SetupPromptResult other than Declined) and legacy setup ran, but LegacyProject::find_by_worktree_dir still fails for the given workdir — e.g., the app data store was not updated or the path normalized differently.

Common situations: GitButler app data directory missing or reset while the workspace expects a project; setup ran non-interactively and silently skipped project registration; path casing/symlink differences between workdir and stored project path.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/38bccb402cbf1b2f. Report an issue: GitHub.

Appendix: source

Thrown at crates/but/src/setup.rs:193

                        let message =
                            format!("No GitButler project found at {}", workdir.display());
                        match prompt_for_setup(out, &message) {
                            SetupPromptResult::RunSetup => {
                                // Run setup
                                let mut ctx = Context::from_repo_with_settings(
                                    repo.clone(),
                                    app_settings.clone(),
                                )?;
                                let mut guard = ctx.exclusive_worktree_access();
                                crate::command::legacy::setup::repo(
                                    &mut ctx,
                                    &args.current_dir,
                                    out,
                                    guard.write_permission(),
                                )?;
                                // Retry finding the project after setup
                                LegacyProject::find_by_worktree_dir(workdir).map_err(|_| {
                                    anyhow::anyhow!(
                                        "Setup completed but project still not found at {}",
                                        workdir.display()
                                    )
                                })?
                            }
                            SetupPromptResult::Declined => {
                                anyhow::bail!(
                                    "Setup required: {message} - run `but setup` to configure the project"
                                );
                            }
                        }
                    }
                };

                // Check project setup, prompt for setup if needed
                let mut ctx =
                    Context::new_from_legacy_project_and_settings(&project, app_settings.clone())?;
                {

View on GitHub (pinned to 58e5313667)