gitbutlerapp/gitbutler · error
Could not determine which forge provider to authenticate…
Error message
Could not determine which forge provider to authenticate with
What it means
Raised in `forge_auth` (crates/but/src/command/config.rs:866) when the interactive prompt for selecting a forge provider returns no selectable option — the user provided no selection (e.g. EOF, non-interactive stdin, or empty option list), so no provider can be chosen.
Solutions
- Run the command in an interactive terminal so the provider prompt can be answered
- Select one of the listed providers when prompted instead of aborting
- Use a non-interactive configuration path (e.g. set forge credentials via config files or env) if no TTY is available
- Ensure the provider list is populated — check your build/features if the list is unexpectedly empty
Example fix
// before echo | but config forge auth # prompt gets EOF -> no selection // after but config forge auth # run interactively and pick GitHub/GitLab
Defensive patterns
Strategy: try-catch
Validate before calling
use std::io::IsTerminal;
if !std::io::stdin().is_terminal() {
return Err("forge auth requires an interactive terminal; configure credentials non-interactively instead");
} Try / catch
match forge_auth(&mut out).await {
Err(e) if e.to_string().contains("which forge provider") => eprintln!("run interactively and select a provider"),
other => other,
} Prevention
- Run interactive config commands only in a TTY
- Check stdin is a terminal before prompting
- Provide credentials via config/env for scripted environments
When it happens
Trigger: Running the forge auth configuration flow when `input.prompt_select(...)` returns `None`: non-interactive stdin (piped/closed), user aborting the prompt, or `auth_options` being empty.
Common situations: Scripting `but config forge auth` without a TTY; CI environments where prompts can't render; canceling the selection dialog.
Understand the failure class
Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- Authorization process aborted by user.
- Could not determine authentication method
- Human input required - run this in a terminal, or specify…
- interactive mode requested, but there is no terminal to…
- Interactive setup requires a terminal. Use `but agent setup…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/8f44ff218419e90a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/config.rs:866
}
let auth_options = nonempty::nonempty![
("GitHub", ForgeProvider::GitHub),
("GitLab", ForgeProvider::GitLab),
("Bitbucket", ForgeProvider::Bitbucket)
];
let selected_option = {
let mut input = out
.prepare_for_terminal_input()
.context("Human input required - run this in a terminal")?;
input
.prompt_select(
"Select a forge provider to authenticate with",
&auth_options,
)?
.cloned()
.ok_or_else(|| {
anyhow::anyhow!("Could not determine which forge provider to authenticate with")
})?
};
match selected_option {
ForgeProvider::GitHub => github_auth(out).await,
ForgeProvider::GitLab => gitlab_auth(out).await,
ForgeProvider::Bitbucket => bitbucket_auth(out).await,
}
}
/// Authenticate with Bitbucket Cloud using an Atlassian API token.
async fn bitbucket_auth(out: &mut OutputChannel) -> Result<()> {
use but_bitbucket::AuthStatusResponse;
let t = theme::get();
let mut inout = out
.prepare_for_terminal_input()
.context("Human input required - run this in a terminal")?;View on GitHub (pinned to 58e5313667)