{"record":{"id":"6c38989f2b58261a","repo":"gitbutlerapp/gitbutler","slug":"no-authenticated-bitbucket-users-found-run-but-c","errorCode":null,"errorMessage":"No authenticated Bitbucket users found.\nRun 'but config forge auth' to authenticate with Bitbucket.","messagePattern":"No authenticated Bitbucket users found\\.\nRun 'but config forge auth' to authenticate with Bitbucket\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but-bitbucket/src/client.rs","lineNumber":626,"sourceCode":"                    _ => err.context(\"Failed to verify Bitbucket credentials\"),\n                };\n            }\n            return err.context(\"Failed to verify Bitbucket credentials\");\n        }\n\n        anyhow::Error::new(HttpStatusError { status }).context(format!(\n            \"Bitbucket repository '{workspace}/{repo_slug}' is inaccessible to this token, or the token is missing required scope `read:repository:bitbucket`\"\n        ))\n    }\n}\n\npub(crate) fn resolve_account(\n    preferred_account: Option<&crate::BitbucketAccountIdentifier>,\n    storage: &but_forge_storage::Controller,\n) -> Result<crate::BitbucketAccountIdentifier, anyhow::Error> {\n    let known_accounts = crate::token::list_known_bitbucket_accounts(storage)?;\n    let Some(default_account) = known_accounts.first() else {\n        bail!(\n            \"No authenticated Bitbucket users found.\\nRun 'but config forge auth' to authenticate with Bitbucket.\"\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 Bitbucket 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","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-bitbucket/src/client.rs#L608-L644","documentation":"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.","triggerScenarios":"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.","commonSituations":"Fresh installs or new user profiles; CI runners without persisted but_forge_storage; storage cleared while debugging; tests running against an empty storage controller.","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)"],"exampleFix":"# before\nbut pr list   # -> No authenticated Bitbucket users found\n\n# after\nbut config forge auth   # complete OAuth for Bitbucket\nbut pr list","handlingStrategy":"validation","validationCode":"// check storage before any Bitbucket operation\nlet known = but_bitbucket::token::list_known_bitbucket_accounts(&forge_storage)?;\nif known.is_empty() {\n    return Ok(Flow::StartAuth(\"but config forge auth\"));\n}","typeGuard":null,"tryCatchPattern":"// this is a setup error: route to the auth flow, never retry the call\nmatch resolve_account(None, &storage) {\n    Err(e) if e.to_string().contains(\"No authenticated Bitbucket users\") => start_forge_auth().await,\n    r => r?,\n}","preventionTips":["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"],"tags":["bitbucket","authentication","forge","setup"],"backgroundTag":"missing-authentication","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}