gitbutlerapp/gitbutler · error
No AI credentials found. Configure in GitButler settings or…
Error message
No AI credentials found. Configure in GitButler settings or set OPENAI_API_KEY environment variable.
What it means
`but branch show --summary` (generate_branch_summary) needs an LLM client. `LLMProvider::from_git_config` tries GitButler proxied credentials, a user's own key in git config, then OPENAI_API_KEY; if all are absent it returns None and the code raises this anyhow error instead of generating the AI summary.
Solutions
- Set the OPENAI_API_KEY environment variable before running the command
- Configure a provider key in GitButler settings (or git config) via `but config ai`
- Sign in / authenticate with GitButler so the proxied Butler API can be used
- Check the key actually reaches the process (export in the same shell, not just .bashrc when run from CI)
Example fix
// before but branch show main --summary // Error: No AI credentials found... // after export OPENAI_API_KEY=sk-... but branch show main --summary
Defensive patterns
Strategy: fallback
Validate before calling
if [ -z "$OPENAI_API_KEY" ]; then
git config --get gitbutler.aiKey >/dev/null || { echo "No AI credentials configured"; exit 1; }
fi Try / catch
match result {
Err(e) if e.to_string().contains("No AI credentials found") => {
eprintln!("Skipping AI summary: configure credentials or set OPENAI_API_KEY.");
}
r => r?,
} Prevention
- Export OPENAI_API_KEY in shells/CI that run summary commands
- Complete `but config ai` once per machine
- Check env inheritance when using systemd/docker/CI wrappers
When it happens
Trigger: Running a branch-summary feature with no AI credentials anywhere: no GitButler account/proxy auth, no ai key in git config, and OPENAI_API_KEY unset in the environment.
Common situations: Fresh machine or CI without credentials configured; users who never signed into GitButler; environments that strip env vars (systemd, docker, CI runners) so OPENAI_API_KEY is missing; rotating/revoked keys removed from config.
Related errors
- Enter an OpenAI API key
- Environment variable OPENAI_API_KEY is not set
- No OpenAI own key configured. Add this through the…
- Could not determine OpenAI credential source
- Enter an Anthropic API key
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/db09aca9f63d2a00.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/legacy/branch/show.rs:420
author_email: String,
timestamp: i64,
files_changed: usize,
insertions: usize,
deletions: usize,
files: Vec<FileChange>,
}
#[instrument(skip(commits, git_config))]
fn generate_branch_summary(
branch_name: &str,
commits: &[CommitInfo],
git_config: &gix::config::File,
) -> anyhow::Result<String> {
use but_llm::LLMProvider;
// Get OpenAI provider (tries GitButler proxied, own key, then env var)
let llm = LLMProvider::from_git_config(git_config).ok_or_else(|| {
anyhow::anyhow!(
"No AI credentials found. Configure in GitButler settings or set OPENAI_API_KEY environment variable."
)
})?;
// Build the prompt with commit information
let mut prompt = format!(
"Please provide a concise summary (2-3 sentences) of what this branch '{branch_name}' accomplishes based on the following commits:\n\n"
);
for commit in commits {
prompt.push_str(&format!("- {}: {}\n", commit.short_sha, commit.message));
if !commit.files.is_empty() {
prompt.push_str(" Files changed:\n");
for file in &commit.files {
prompt.push_str(&format!(
" {} ({}, +{}, -{})\n",
file.path, file.status, file.insertions, file.deletions
));View on GitHub (pinned to 58e5313667)