gitbutlerapp/gitbutler · error · anyhow::Error
No authenticated Bitbucket users found. Run 'but config…
Error message
No authenticated Bitbucket users found. Run 'but config forge auth' to authenticate with Bitbucket.
What it means
resolve_account() bails when but_forge_storage holds no known Bitbucket accounts at all — list_known_bitbucket_accounts() returned an empty list. The message doubles as user guidance, pointing at the 'but config forge auth' command that performs the OAuth flow and records the account.
Solutions
- Run 'but config forge auth' and authenticate with Bitbucket, then retry
- Verify the forge storage location the app reads is the one your auth flow wrote to (same user/profile/backup restore)
- In automation, pre-provision the token via the auth flow before running Bitbucket commands
- Check that the token storage is not being cleaned between runs (temp-dir cleanup, container recreation)
Example fix
# before but pr list # -> No authenticated Bitbucket users found # after but config forge auth # complete OAuth for Bitbucket but pr list
Defensive patterns
Strategy: validation
Validate before calling
// check storage before any Bitbucket operation
let known = but_bitbucket::token::list_known_bitbucket_accounts(&forge_storage)?;
if known.is_empty() {
return Ok(Flow::StartAuth("but config forge auth"));
} Try / catch
// this is a setup error: route to the auth flow, never retry the call
match resolve_account(None, &storage) {
Err(e) if e.to_string().contains("No authenticated Bitbucket users") => start_forge_auth().await,
r => r?,
} Prevention
- Gate every Bitbucket feature behind an 'accounts exist' check that offers the auth command
- Persist forge storage somewhere that survives app updates and reboots
- In CI, provision auth as an explicit setup step before Bitbucket commands
When it happens
Trigger: Constructing any Bitbucket client operation that resolves an account (preferred_account = None) on a machine/profile where 'but config forge auth' for Bitbucket has never completed, or whose forge-storage database was wiped/reset.
Common situations: Fresh installs or new user profiles; CI runners without persisted but_forge_storage; storage cleared while debugging; tests running against an empty storage controller.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- No Bitbucket access token found for account
- Preferred Bitbucket account
- Known account is not correctly authenticated. Run
- No authenticated forge users found. Run
- NOT_AUTHENTICATED
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/6c38989f2b58261a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-bitbucket/src/client.rs:626
_ => err.context("Failed to verify Bitbucket credentials"),
};
}
return err.context("Failed to verify Bitbucket credentials");
}
anyhow::Error::new(HttpStatusError { status }).context(format!(
"Bitbucket repository '{workspace}/{repo_slug}' is inaccessible to this token, or the token is missing required scope `read:repository:bitbucket`"
))
}
}
pub(crate) fn resolve_account(
preferred_account: Option<&crate::BitbucketAccountIdentifier>,
storage: &but_forge_storage::Controller,
) -> Result<crate::BitbucketAccountIdentifier, anyhow::Error> {
let known_accounts = crate::token::list_known_bitbucket_accounts(storage)?;
let Some(default_account) = known_accounts.first() else {
bail!(
"No authenticated Bitbucket users found.\nRun 'but config forge auth' to authenticate with Bitbucket."
);
};
let account = if let Some(account) = preferred_account {
if known_accounts.contains(account) {
account
} else {
bail!(
"Preferred Bitbucket account '{account}' has not authenticated yet.\nRun 'but config forge auth' to authenticate, or choose another account."
);
}
} else {
default_account
};
Ok(account.to_owned())
}
View on GitHub (pinned to caf1f223d3)