{"record":{"id":"412027e62e72ebf7","repo":"gitbutlerapp/gitbutler","slug":"no-bitbucket-access-token-found-for-account-acco","errorCode":null,"errorMessage":"No Bitbucket access token found for account '{account_id}'.\nRun 'but config forge auth' to re-authenticate.","messagePattern":"No Bitbucket access token found for account '(.+?)'\\.\nRun 'but config forge auth' to re-authenticate\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but-bitbucket/src/client.rs","lineNumber":64,"sourceCode":"            .default_headers(headers)\n            .timeout(BITBUCKET_REQUEST_TIMEOUT)\n            .build()?;\n\n        Ok(Self {\n            client,\n            base_url: BITBUCKET_API_BASE_URL.to_string(),\n        })\n    }\n\n    pub fn from_storage(\n        storage: &but_forge_storage::Controller,\n        preferred_account: Option<&crate::BitbucketAccountIdentifier>,\n    ) -> Result<Self> {\n        let account_id = resolve_account(preferred_account, storage)?;\n        if let Some(access_token) = crate::token::get_bb_access_token(&account_id, storage)? {\n            account_id.client(&access_token)\n        } else {\n            Err(anyhow::anyhow!(\n                \"No Bitbucket access token found for account '{account_id}'.\\nRun 'but config forge auth' to re-authenticate.\"\n            ))\n        }\n    }\n\n    pub async fn get_authenticated(&self) -> Result<AuthenticatedUser> {\n        let url = format!(\"{}/user\", self.base_url);\n        let response = self.client.get(&url).send().await?;\n\n        if !response.status().is_success() {\n            return Err(HttpStatusError {\n                status: response.status(),\n            }\n            .into());\n        }\n\n        let user: BitbucketApiUser = response.json().await?;\n        Ok(AuthenticatedUser {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-bitbucket/src/client.rs#L46-L82","documentation":"BitbucketClient::from_storage resolved which account to use from stored forge configuration, but found no access token for that account in token storage. Without a token no API calls are possible, so the constructor fails and the message points at the re-authentication command ('but config forge auth').","triggerScenarios":"Constructing BitbucketClient::from_storage (directly or via any Bitbucket forge feature) when the resolved account's token entry is absent: the user never completed auth, the token was purged, or OS secret storage denied access.","commonSituations":"First use with no prior `but config forge auth`; app data or OS keychain reset/locked (macOS keychain, Windows credential manager, Linux secret service); migration or cleanup wiped stored tokens.","solutions":["Run `but config forge auth` and complete the Bitbucket flow to store a fresh token","Confirm the account id named in the error is the account you expect (`but config forge` to list configured accounts)","If auth succeeds but the error returns, check OS keychain/secret-service permissions for the but/GitButler app"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Rust: check token availability before constructing the client\nlet account_id = resolve_account(preferred_account, storage)?;\nif but_bitbucket::token::get_bb_access_token(&account_id, storage)?.is_none() {\n    // prompt `but config forge auth` instead of calling BitbucketClient::from_storage\n}","typeGuard":null,"tryCatchPattern":"match BitbucketClient::from_storage(storage, preferred) {\n    Err(err) if err.to_string().contains(\"No Bitbucket access token\") => {\n        // prompt re-auth (`but config forge auth`), then retry once\n    }\n    result => result,\n}","preventionTips":["Run forge authentication setup during onboarding, before any Bitbucket feature is used","Handle expired/missing tokens as a re-auth prompt, not an error dialog","Verify OS keychain/secret-service access for the app when tokens repeatedly vanish"],"tags":["bitbucket","authentication","access-token","forge"],"backgroundTag":"missing-oauth-token","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}