gitbutlerapp/gitbutler · error
No GitButler token available. Log-in to use the GitButler…
Error message
No GitButler token available. Log-in to use the GitButler Anthropic provider
What it means
gitbutler_proxied_creds retrieves the GitButler access token from the OS secret store (handle GITBUTLER_ACCESS_TOKEN_HANDLE) to use the Anthropic provider proxied through GitButler. When no token is stored, it throws "No GitButler token available. Log-in to use the GitButler Anthropic provider". It is an authentication precondition, not a network failure.
Solutions
- Log in to GitButler (but login / the desktop app sign-in) so an access token is stored
- Check the OS keychain/keyring is accessible (unlock gnome-keyring/login keychain)
- Verify the token handle exists in the secret store after login
- Alternatively configure your own Anthropic API key and switch providers
Defensive patterns
Strategy: try-catch
Validate before calling
// check for a stored token before selecting the provider
let has_token = secret::retrieve(GITBUTLER_ACCESS_TOKEN_HANDLE, secret::Namespace::BuildKind)
.map(|t| t.is_some()).unwrap_or(false);
if !has_token { eprintln!("log in to GitButler first"); } Try / catch
// fall back to another provider or prompt for login
match select_anthropic_provider().await {
Err(e) if e.to_string().contains("No GitButler token available") => {
prompt_gitbutler_login()?;
}
other => other?,
} Prevention
- Run `but login` (or app sign-in) before using LLM features
- In CI, provision a token in the keyring or use an env-var-based provider
- After logout, re-authenticate before invoking proxied providers
When it happens
Trigger: Selecting the GitButler-proxied Anthropic provider while secret::retrieve returns None because the user has never logged in to GitButler or the token was removed from the keyring.
Common situations: Fresh machine/install without login, keychain/keyring access denied or cleared, CI containers with no stored credentials, or logging out then invoking LLM features.
Related errors
- No Anthropic own key configured. Add this through the…
- No GitButler token available. Log-in to use the GitButler…
- askpass broker must be initialized
- Authorization process aborted by user.
- BUG: Sensitive data cannot be serialized - it needs to be…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/946d05c53e607687.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-llm/src/anthropic.rs:138
Err(e) => {
tracing::error!("Failed to retrieve Anthropic credentials: {}", e);
None
}
}
}
pub fn client(&self) -> Result<AnthropicClient> {
let credentials = &self.credentials.1;
let kind = self.credentials.0.clone();
AnthropicClient::new(kind, credentials)
}
pub fn credentials_kind(&self) -> CredentialsKind {
self.credentials.0.clone()
}
fn gitbutler_proxied_creds() -> Result<(CredentialsKind, Sensitive<String>)> {
let creds = secret::retrieve(GITBUTLER_ACCESS_TOKEN_HANDLE, secret::Namespace::BuildKind)?
.ok_or(anyhow::anyhow!(
"No GitButler token available. Log-in to use the GitButler Anthropic provider"
))?;
Ok((CredentialsKind::GitButlerProxied, creds))
}
fn anthropic_own_key_creds() -> Result<(CredentialsKind, Sensitive<String>)> {
let creds = secret::retrieve(AI_ANTHROPIC_SECRET_HANDLE, secret::Namespace::Global)?
.ok_or(anyhow::anyhow!(
"No Anthropic own key configured. Add this through the GitButler settings"
))?;
Ok((CredentialsKind::OwnAnthropicKey, creds))
}
fn anthropic_env_var_creds() -> Result<(CredentialsKind, Sensitive<String>)> {
let creds = Sensitive(
std::env::var_os("ANTHROPIC_API_KEY")
.ok_or(anyhow::anyhow!(
"Environment variable ANTHROPIC_API_KEY is not set"View on GitHub (pinned to 58e5313667)