stablyai/orca · error · Error
Bitbucket request failed: HTTP ${response.status}
Error message
Bitbucket request failed: HTTP ${response.status} What it means
Thrown by the Bitbucket requestJson helper when the HTTP response is not ok (and not a 404-with-notFoundIsNull case) and the caller passed throwOnFailure=true. The status code is interpolated into the message. It represents a definitive transport/auth/server failure that the caller explicitly asked to surface rather than collapse to null.
Source
Thrown at src/main/bitbucket/client.ts:102
throw new Error('Bitbucket request failed: no usable credential')
}
return null
}
try {
const response = await fetch(apiUrl(config.baseUrl, path, options.searchParams), {
headers: {
Accept: 'application/json',
...authHeaders(config)
},
signal: AbortSignal.timeout(options.timeoutMs ?? REQUEST_TIMEOUT_MS)
})
if (!response.ok) {
await cancelUnreadResponseBody(response)
if (response.status === 404 && notFoundIsNull) {
return null
}
if (throwOnFailure) {
throw new Error(`Bitbucket request failed: HTTP ${response.status}`)
}
return null
}
return (await response.json()) as T
} catch (error) {
if (throwOnFailure) {
throw error
}
return null
}
}
function encodedRepoPath(repo: BitbucketRepoRef): string {
return `${encodeURIComponent(repo.workspace)}/${encodeURIComponent(repo.repoSlug)}`
}
function escapeBitbucketQueryString(value: string): string {
return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')View on GitHub (pinned to 1136503c6a)
Solutions
- Map response.status: 401/403 -> refresh the app password; 404 (when not notFoundIsNull) -> verify workspace/repo slug; 429 -> back off; 5xx -> retry.
- Catch the Error in the throwOnFailure caller and present it as a review-lookup transport failure.
- Verify the BitbucketRepoRef (workspace, repoSlug) before calling.
- Confirm the app password has the required scopes (Repositories: Read, Pull requests: Read).
Example fix
// before
const pr = await requestJson(path, {}, true)
// after
let pr
try {
pr = await requestJson(path, {}, true)
} catch (err) {
if (/HTTP 401|HTTP 403/.test(err.message)) {
throw new Error('Bitbucket credential rejected — refresh your app password')
}
throw err
} Defensive patterns
Strategy: try-catch
Validate before calling
import { resolveBitbucketAuthConfig, hasAuth } from './bitbucket-auth-config'\n\nif (!hasAuth(resolveBitbucketAuthConfig())) {\n throw new Error('Bitbucket credential required')\n}\n// verify workspace/repo slug shape before the call Try / catch
try {\n return await requestJson(path, options, true)\n} catch (err) {\n const msg = (err as Error).message\n if (/HTTP 401|HTTP 403/.test(msg)) {\n throw new Error('Bitbucket credential rejected — refresh your app password')\n }\n if (/HTTP 429/.test(msg)) {\n await backoff()\n return await requestJson(path, options, true)\n }\n throw err\n} Prevention
- Verify the BitbucketRepoRef (workspace, repoSlug) before calling.
- Confirm the app password has Repositories: Read and Pull requests: Read scopes.
- Map HTTP status codes to remediation guidance.
- Back off on 429 rate-limit responses.
When it happens
Trigger: A Bitbucket API call with throwOnFailure=true returning 401/403 (bad/expired app password), 429 (rate limited), 500 (server error), or a non-404 4xx (bad query/path). Timeouts and network errors are re-thrown by the outer catch as well.
Common situations: Expired or revoked app password, insufficient repository permission, wrong workspace/repo slug, Bitbucket rate limiting, or a network interruption.
Related errors
- Azure DevOps request failed: HTTP ${response.status}
- GitHub API ${method} ${path} failed with ${response.status}:
- Bitbucket request failed: no usable credential
- Gitea request failed: HTTP ${response.status}
- GitHub request failed ${res.status} ${res.statusText}: ${bod
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/5133e3a071a10b51.
Report an issue: GitHub.