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
- Open the GitButler desktop app and add the folder as a project so it is registered, then retry the CLI command.
- Check that the directory you are running from matches the actual worktree path (avoid symlinked/relative paths).
- Inspect the app data/project store (e.g. ~/.local/share/gitbutler) for a stale or missing projects database entry and repair or reset it.
- 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
- Run CLI commands from the canonical worktree path (avoid symlinks).
- Keep the GitButler app running/healthy so the project store stays consistent.
- Register projects through the app before CLI automation.
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
- `but setup` cannot run from a linked worktree; run it from…
- No git repository found at
- No git repository found - run `but setup --init` to…
- No HEAD reference found for remote
- Repository has no working directory
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)