gitbutlerapp/gitbutler · error
Setup required: - run `but setup` to configure the project
Error message
Setup required: {message} - run `but setup` to configure the project What it means
During init_ctx, project setup validation found a problem (message from the setup check). The CLI surfaced an interactive setup prompt and the user (or a non-interactive environment) declined it, so initialization bails with 'Setup required'. It directs the user to `but setup` to configure the project.
Solutions
- Run `but setup` in the repository and follow the prompts.
- Re-run the original command and accept the setup prompt when shown.
- In CI/scripts, run `but setup` non-interactively as a prior step instead of relying on the inline prompt.
Example fix
// before (CI script) but push // after but setup && but push
Defensive patterns
Strategy: try-catch
Validate before calling
# detect uninitialized project before non-interactive use [ -d .git/gitbutler ] || but setup
Try / catch
if ! but status 2>&1 | grep -q 'Setup required'; then but push else but setup && but push fi
Prevention
- Run `but setup` immediately after cloning
- In CI, complete setup as a pre-step since prompts auto-decline
- Never dismiss the setup prompt expecting the command to continue
When it happens
Trigger: init_ctx detects the project is missing/not configured, shows the SetupPrompt, and SetupPromptResult::Declined is returned — e.g. the user answered no, or the prompt auto-declined in a non-TTY/scripted context.
Common situations: Running but in a repo never initialized with `but setup`; CI or piped commands where the interactive prompt cannot render and is declined automatically.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- `but setup` cannot run from a linked worktree; run it from…
- Could not determine Anthropic credential source
- Could not determine OpenAI credential source
- Could not determine selected AI provider
- Could not determine selected review template
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/9d248f9d1321d971.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/setup.rs:200
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())?;
{
let mut guard = ctx.exclusive_worktree_access();
if let Err(e) = check_project_setup(&ctx, guard.read_permission()) {
let message = e.to_string();
match prompt_for_setup(out, &message) {
SetupPromptResult::RunSetup => {
// Run setup to fix the project configuration
crate::command::legacy::setup::repo(View on GitHub (pinned to 58e5313667)