Pipeline runner hosted build is failing with 500 error in Bitbucket Cloud
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
Pipeline Builds fails with the following error message on Self-hosted Runners:
1
com.atlassian.pipelines.stargate.client.core.exceptions.StargateInternalServerErrorException: Response Summary: HttpResponseSummary {httpStatusCode=500, httpStatusMessage=Internal Server Error, bodyAsString={"code":500,"message":"There was an error processing your request. It has been logged (ID XXXXXXXXXXXX)."}}
Environment
This article is related to builds running on Bitbucket cloud Self-hosted Runners.
Diagnosis
Verify the Self-hosted Runner log and see the following error:
1
2
3
4
5
6
7
8
9
10
[2023-08-21 13:51:39,393] Getting step StepId{accountUuid={XXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXXXX}, repositoryUuid={XXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXXXX}, pipelineUuid={XXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXXXX}, stepUuid={XXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXXXX}.
[2023-08-21 13:51:39,401] Getting oauth token for step.
[2023-08-21 13:51:39,413] Getting environment variables for step.
[2023-08-21 13:51:56,647] An error occurred whilst getting oauth token.
com.atlassian.pipelines.stargate.client.core.exceptions.StargateInternalServerErrorException: Response Summary: HttpResponseSummary{httpStatusCode=500, httpStatusMessage=Internal Server Error, bodyAsString={"code":500,"message":"There was an error processing your request. It has been logged (ID XXXXXXXXXXXX)."}}
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
*__checkpoint ⇢ 500 from POST https://api.atlassian.com/ex/bitbucket-pipelines/rest/1.0/accounts/%7BXXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXXXX%7D/repositories/%7BXXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXXXX%7D/oauth [DefaultWebClient]
Original Stack Trace:
Check if the accountUuid field in the first line in the above log matches the workspace's UUID. You can run the following API call locally to get the workspace's UUID:
1
2
3
4
5
$ Curl -X GET -u <username>:<apppassword> "https://api.bitbucket.org/2.0/workspaces/<workspace>?fields=slug,uuid"
{
"uuid": "{XXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXXXX}",
"slug": "<workspace>"
}
For this specific issue, the accounUuid mentioned in the logs will not match your actual workspace UUID.
Cause
This problem typically arises when a repository with a Self-hosted runner setup is moved to a new workspace. Initially, the Self-hosted runner setup associates itself with the original workspace and repository UUID. However, when the repository is transferred to a new workspace, the account UUID changes, while the repository UUID remains the same. This mismatch is what causes the issue.
Solution
Navigate to Repository's settings > Runners
Find the affected Runner and delete it by clicking on the three-doted icon > Delete
After successfully removing the affected Runner, create a new runner which should now be attached to the correct workspace.
Was this helpful?