{"record":{"id":"5631e9c116ce3f45","repo":"gitbutlerapp/gitbutler","slug":"bitbucket-request-failed-status","errorCode":null,"errorMessage":"Bitbucket request failed: {status}","messagePattern":"Bitbucket request failed: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-bitbucket/src/client.rs","lineNumber":584,"sourceCode":"                return Err(self\n                    .classify_repository_access_error(repository_status, workspace, repo_slug)\n                    .await);\n            }\n            return Err(anyhow::Error::new(HttpStatusError {\n                status: repository_status,\n            })\n            .context(\"Failed to verify Bitbucket repository access\"));\n        }\n        if matches!(\n            status,\n            reqwest::StatusCode::UNAUTHORIZED | reqwest::StatusCode::FORBIDDEN\n        ) {\n            return Err(self\n                .classify_repository_access_error(status, workspace, repo_slug)\n                .await);\n        }\n        if !status.is_success() {\n            bail!(\"Bitbucket request failed: {status}\");\n        }\n\n        let page: Paginated<BitbucketApiBuildStatus> = response.json().await?;\n        let mut statuses = page.values;\n        if let Some(next) = page.next {\n            statuses.extend(self.get_paginated(next).await?);\n        }\n        Ok(Some(\n            statuses\n                .into_iter()\n                .map(BitbucketBuildStatus::from_api)\n                .collect(),\n        ))\n    }\n\n    async fn repository_status(\n        &self,\n        workspace: &str,","sourceCodeStart":566,"sourceCodeEnd":602,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-bitbucket/src/client.rs#L566-L602","documentation":"In list_checks_for_ref, after attempting to classify repository-access failures, any remaining non-success HTTP status for the commit-status/build-status endpoint is turned into this generic error carrying the status. It means the build-status listing could not be retrieved for a reason other than the recognized access problems.","triggerScenarios":"Calling list_checks_for_ref when the statuses endpoint returns 401 (expired token), 429 (rate limit), 5xx (Bitbucket outage), or an access error shape that classify_repository_access_error does not recognize.","commonSituations":"Rate limiting while polling CI status in a loop; transient Bitbucket Cloud 5xx; token revoked mid-session; commit SHA with no statuses plus a permission quirk.","solutions":["Inspect the status in the message: retry with backoff on 429/5xx, refresh credentials on 401","Check the token's repository read scope","Cache/poll less frequently to avoid Bitbucket rate limits","Confirm the workspace/repo-slug and commit SHA are correct"],"exampleFix":"// before\nlet checks = client.list_checks_for_ref(workspace, repo_slug, sha).await?;\n// after\nlet checks = retry_backoff(3, || client.list_checks_for_ref(workspace, repo_slug, sha)).await?;","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"429\") || e.to_string().contains(\"50\") => { backoff_retry(3, op)?; }\n    other => other?,\n}","preventionTips":["Poll CI status at a modest interval to avoid rate limits","Refresh tokens proactively","Cache status responses briefly","Distinguish access errors from transient ones by inspecting the status in the message"],"tags":["network","http","bitbucket","ci","api-error"],"backgroundTag":"http-error-response","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}