{"record":{"id":"cc21d0aa0bd46cb9","repo":"gitbutlerapp/gitbutler","slug":"preferred-github-account-account-has-not-authe","errorCode":null,"errorMessage":"Preferred GitHub account '{account}' has not authenticated yet.\\nRun 'but config forge auth' to authenticate, or choose another account.","messagePattern":"Preferred GitHub account '(.+?)' has not authenticated yet\\.\\\\nRun 'but config forge auth' to authenticate, or choose another account\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but-github/src/client.rs","lineNumber":1977,"sourceCode":"        }\n    }\n}\n\npub(crate) fn resolve_account(\n    preferred_account: Option<&crate::GithubAccountIdentifier>,\n    storage: &but_forge_storage::Controller,\n) -> Result<crate::GithubAccountIdentifier, anyhow::Error> {\n    let known_accounts = crate::token::list_known_github_accounts(storage)?;\n    let Some(default_account) = known_accounts.first() else {\n        bail!(\n            \"No authenticated GitHub users found.\\nRun 'but config forge auth' to authenticate with GitHub.\"\n        );\n    };\n    let account = if let Some(account) = preferred_account {\n        if known_accounts.contains(account) {\n            account\n        } else {\n            bail!(\n                \"Preferred GitHub account '{account}' has not authenticated yet.\\nRun 'but config forge auth' to authenticate, or choose another account.\"\n            );\n        }\n    } else {\n        default_account\n    };\n\n    Ok(account.to_owned())\n}\n\n#[derive(Serialize)]\nstruct CheckRunsQuery<'a> {\n    filter: &'a str,\n    per_page: usize,\n    page: usize,\n}\n\n/// Render a failed response as `<status>: <body>` so GitHub's error message reaches the user.","sourceCodeStart":1959,"sourceCodeEnd":1995,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-github/src/client.rs#L1959-L1995","documentation":"A preferred GitHub account was passed to resolve_account, but it is not among the known (stored) authenticated accounts, so it cannot be used. The default - the first known account - is only chosen when no preference is expressed.","triggerScenarios":"A config entry or CLI flag names an account that never authenticated on this machine; the account was removed via logout; the identifier's casing or format differs from what was stored; the signed-in user changed.","commonSituations":"Multi-account setups; configs synced to a machine where only another account authenticated; GitHub username changes.","solutions":["Authenticate that account: `but config forge auth`","Or clear/change the preferred-account setting so the default known account is used","Make sure the identifier matches exactly what was stored during authentication"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let known = crate::token::list_known_github_accounts(storage)?;\nif let Some(preferred) = &preferred_account {\n    if !known.contains(preferred) {\n        anyhow::bail!(\"account {preferred} not authenticated - run `but config forge auth`\");\n    }\n}","typeGuard":"fn account_is_known(account: &GithubAccountIdentifier, known: &[GithubAccountIdentifier]) -> bool {\n    known.contains(account)\n}","tryCatchPattern":"match do_forge_operation().await {\n    Err(e) if e.to_string().contains(\"has not authenticated yet\") => {\n        clear_preferred_account_and_use_default()\n    }\n    other => other?,\n}","preventionTips":["Validate the preferred-account setting against stored accounts at startup","Use the exact identifier produced by authentication","Re-authenticate after switching or renaming GitHub accounts"],"tags":["github","authentication","multi-account","configuration"],"backgroundTag":"unauthenticated-account","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}