gitbutlerapp/gitbutler · error · anyhow::Error

No authenticated GitHub users found.\nRun 'but config forge

Error message

No authenticated GitHub users found.\nRun 'but config forge auth' to authenticate with GitHub.

What it means

resolve_account queried the stored GitHub accounts and found none, so there is no credential to pick - not even a default. Every forge operation that talks to GitHub needs at least one authenticated user first; the message itself names the remedy.

Source

Thrown at crates/but-github/src/client.rs:1969

            repo_owner: pr
                .head
                .repo
                .as_ref()
                .and_then(|r| r.owner.as_ref().map(|o| o.login.clone())),
            head_repo_is_fork: pr.head.repo.as_ref().map(|r| r.fork).unwrap_or(false),
            requested_reviewers,
            auto_merge_enabled: pr.auto_merge.is_some(),
        }
    }
}

pub(crate) fn resolve_account(
    preferred_account: Option<&crate::GithubAccountIdentifier>,
    storage: &but_forge_storage::Controller,
) -> Result<crate::GithubAccountIdentifier, anyhow::Error> {
    let known_accounts = crate::token::list_known_github_accounts(storage)?;
    let Some(default_account) = known_accounts.first() else {
        bail!(
            "No authenticated GitHub users found.\nRun 'but config forge auth' to authenticate with GitHub."
        );
    };
    let account = if let Some(account) = preferred_account {
        if known_accounts.contains(account) {
            account
        } else {
            bail!(
                "Preferred GitHub 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)

Solutions

  1. Run `but config forge auth` and complete the device flow
  2. Verify the config/storage location is the one the CLI actually uses (same user, same home)
  3. Re-run the original forge command
Defensive patterns

Strategy: validation

Validate before calling

if crate::token::list_known_github_accounts(storage)?.is_empty() {
    anyhow::bail!("no GitHub account on this machine - run `but config forge auth` first");
}

Try / catch

match do_forge_operation().await {
    Err(e) if e.to_string().contains("No authenticated GitHub users") => {
        launch_auth_flow().await?; // then retry the operation
        do_forge_operation().await
    }
    other => other,
}

Prevention

When it happens

Trigger: First run before any `but config forge auth`; the auth storage is missing or wiped (fresh home directory, CI container); all accounts were previously logged out.

Common situations: Fresh installs; CI containers without persisted config directories; running as a different user than the one who authenticated.

Understand the failure class

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/d29ff0d18108cebd. Report an issue: GitHub.