Trying to rerun failed or incomplete jobs result in XSRF: A mutative operation was attempted on BuildResultsSummaryImpl within a non-mutative HTTP request
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
Summary
Trying to rerun failed or incomplete jobs by right-clicking Run > Rerun failed/incomplete jobs only and attempting to open the link in a new tab in your web browser results in the following errors thrown by Bamboo:
Environment
This was verified on Bamboo 6.9.2, 7.0.3, 7.1.2 and 7.2.1 but may affect other Bamboo versions as well given the nature of the problem.
Diagnosis
- This usually only happens when opening the link to Run > Rerun failed/incomplete jobs only in a new tab.
- In certain cases the problem seems to persist and further attempts to click Run > Rerun failed/incomplete jobs only or Run > Run plan without opening the link on a new tab will continue to throw errors.
Cause
Cause 1
This is caused by the fact that Bamboo is expecting a POST request when clicking the Run > Rerun failed/incomplete jobs only option from the UI. However, when attempting to open that link in a new tab the web browser will trigger a GET request instead. You can search for the request received by Bamboo in the <Bamboo server home directory>/logs/atlassian-bamboo-access.log file:
2021-01-22 10:43:14,999 INFO [http-nio-8085-exec-5] [AccessLogFilter] username GET http://bamboo:8085/build/admin/restartBuild.action?planKey=PROJ-PLAN&buildNumber=13 156766kb
Bamboo doesn't accept GET requests on the restartBuild.action and the error is thrown.
Cause 2
This also could be caused by important script resources missing in the Bamboo server. You may see the below errors in atlassian-bamboo.log.
2022-03-19 21:11:00,943 WARN [http-nio-8085-exec-6] [AbstractDownloadableResource] Resource not found: Resource: bamboo.web.resources /scripts/xsrf.js (null)
Solution
- If you are trying to rerun failed or incomplete jobs don't try to open the link in a new tab to if you want to avoid running into this issue.
- In case you have accidentally or unknowingly tried to open the Run > Rerun failed/incomplete jobs only in a new tab and now further attempts to rerun or trigger a new build inside that plan fail with the same error message, try disabling/enabling the affected plan.
- Please check the <bamboo-install>/atlassian-bamboo/scripts directory and verify xsrf.js is present