gitbutlerapp/gitbutler · error
Bitbucket request failed
Error message
Bitbucket request failed: {status} What it means
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.
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
Example fix
// before let checks = client.list_checks_for_ref(workspace, repo_slug, sha).await?; // after let checks = retry_backoff(3, || client.list_checks_for_ref(workspace, repo_slug, sha)).await?;
Defensive patterns
Strategy: retry
Try / catch
match result {
Err(e) if e.to_string().contains("429") || e.to_string().contains("50") => { backoff_retry(3, op)?; }
other => other?,
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Bitbucket request failed
- Failed to update pull request
- Failed to decline pull request
- Failed to fetch repository
- Failed to merge pull request
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/5631e9c116ce3f45.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-bitbucket/src/client.rs:584
return Err(self
.classify_repository_access_error(repository_status, workspace, repo_slug)
.await);
}
return Err(anyhow::Error::new(HttpStatusError {
status: repository_status,
})
.context("Failed to verify Bitbucket repository access"));
}
if matches!(
status,
reqwest::StatusCode::UNAUTHORIZED | reqwest::StatusCode::FORBIDDEN
) {
return Err(self
.classify_repository_access_error(status, workspace, repo_slug)
.await);
}
if !status.is_success() {
bail!("Bitbucket request failed: {status}");
}
let page: Paginated<BitbucketApiBuildStatus> = response.json().await?;
let mut statuses = page.values;
if let Some(next) = page.next {
statuses.extend(self.get_paginated(next).await?);
}
Ok(Some(
statuses
.into_iter()
.map(BitbucketBuildStatus::from_api)
.collect(),
))
}
async fn repository_status(
&self,
workspace: &str,View on GitHub (pinned to 58e5313667)