Failed to load data from Bitbucket. 401 Unauthorized using app password from Bitbucket cloud
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
An attempt to add Bitbucket Cloud Linked repository with username and password authentication to Bamboo, fails with an error message of "Can't find a repository named {name}" in Bamboo UI, and the following appears in the log file atlassian-bamboo.log
WARN [http-nio-8085-exec-5] [RESTCall] Response from GET https://api.bitbucket.org/2.0/workspaces/USERNAME/ (404)
Cause
Bitbucket cloud API to fetch repository includes the workspace name as a URL parameter.
GET /2.0/repositories/{workspace}/{repo_slug}
The workspace name should match the username used to access to access the repository. causing only a search of repository with the username to be successful, but attempts to save the repository returned 404.
Resolution
Ensure the workspace name is same as the username, e.g. if a username is johnc
changed the workspace name to be johnc
.