Could not generate next build number exception
Asked by Varun Malhotra:

Every time we try to build a plan We get "**Error encountered while triggering manual build: Could not generate next build number** " exception.

Also, Bamboo is unable to read a branch tree from the repository, it just freezes.

Could someone please help!

<br />


Answers:
author: Przemek Bruski
body: The fix has been rolled out to all customers now. Apologies for the problems it caused.

comments: author: appregidc
body: hello, i'm using 5.6, how i can fix this problem?


author: Shenbaga Deepan
body: Hi Przemek,

Can you please confirm on which version the fix has been rolled out?


author: Theo_Tsatsos
body: Can you please confirm on which version the fix has been rolled out?


author: joshbenner
body: Confirmed. Clear browser cache (or shift-reload) to get updated assets which seem to fix these errors.


author: Gobinda Thapa
body: I am also getting same error. However try Run\> Run Customized and Run.


author: Przemek Bruski
body: We are working on delivering a fix to this issue as soon as possible.

comments: author: Anj Willnecker
body: Hi, What was the fix for this issue as we're experiencing it.


author: Andrew Cheng
body: I'm having the same problem. It seems like bamboo got upgrade to 5.10 this morning which caused the problem.


author: Vilimir Buzev
body: Hello, I'm with Bamboo version 7.1.2 and also still have this issue.

Here is the errors in the log:

Caused by: java.lang.IllegalStateException: XSRF: A mutative operation was attempted on PlanBuildNumbersImpl(id=33226772) within a non-mutative HTTP ----\>\>\>

Error encountered while triggering manual build: Could not generate next build number for 'F\*\*\*\*\*\*\*\*\*\*'

Plan 'F\*\*\*\*\*\*\*\*\*\*\*\*' did not start

I also will raise a ticket


author: Vladimir Mironov
body: Hello from 2019. I'm on Bamboo v6.10.3 and still have this issue


author: chphilli
body: I'm seeing this tonight all of a sudden. I can work around it by running a customized build.


author: Tej Parekh
body: Hey, Its working for me now! Thanks Atlassin Team!


author: Tej Parekh
body: Hey I am facing the issue while building the production since yesterday

**Error encountered while triggering manual build: Could not generate next build number for**

Do we have the fix for it yet? Atlassin Team, Kindly update us as soon as you have the fix updated.

Thanks!


author: Alex Cheng
body: Same issue here. When will a fix be available?


author: Vincent Nys
body: Idem here, i have the same error!

Thnx


author: Lyndon Barrie
body: Ditto. I'm getting the same on, on demand.

Thanks


author: Antoine Lyseight
body: I am having the same issue with Elastic Bamboo. What are the next steps?


author: Anthony Mallica
body: Confirming that we are seeing the exact same issue, stack trace and everything. We are stuck until this is resolved.


author: Nathan Shilling
body: Hoping Bamboo Cloud gets updated soon. I'm having same issue


author: Alexander Antonov
body: The same problem on my Bamboo OnDemand:

```
{"status":"ERROR","errors":["Error encountered while triggering manual build: Could not generate next build number for 'MFS-EBS'","Plan 'MFS-EBS' did not start"]}
```

Exception from stacktrace:

```
Caused by: java.lang.IllegalStateException: XSRF: A mutative operation was attempted on DefaultChain within a non-mutative HTTP request: https://mileforsmile.atlassian.net/builds/build/admin/ajax/startPlan.action?planKey=MFS-EBS : [[CHAIN, 2013-07-25 22:32:12.785, 2015-06-29 06:25:27.222, MFS-EBS, EBS, EBS redeploy (test), Upload and deploy latest version to the Test EBS server, 1, 689, 690, false, false, com.atlassian.bamboo.project.DefaultProject@12dad, com.atlassian.bamboo.build.DefaultBuildDefinitionForBuild@f2ef2759, [com.atlassian.bamboo.labels.LabellingImpl@4d11ffcf], [], null, com.atlassian.bamboo.notification.NotificationSetImpl@10c8001, [com.atlassian.bamboo.chains.ChainStageImpl@f3f4ad92]]]->->[[CHAIN, 2013-07-25 22:32:12.785, 2015-06-29 06:25:27.222, MFS-EBS, EBS, EBS redeploy (test), Upload and deploy latest version to the Test EBS server, 1, 690, 691, false, false, com.atlassian.bamboo.project.DefaultProject@12dad, com.atlassian.bamboo.build.DefaultBuildDefinitionForBuild@f2ef2759, [com.atlassian.bamboo.labels.LabellingImpl@4d11ffcf], [], null, com.atlassian.bamboo.notification.NotificationSetImpl@10c8001, [com.atlassian.bamboo.chains.ChainStageImpl@f3f4ad92]]]	at com.atlassian.bamboo.utils.XsrfUtils.fail(XsrfUtils.java:32)	at com.atlassian.bamboo.hibernate.ReadOnlyGetMethodEnforcer.fail(ReadOnlyGetMethodEnforcer.java:109)	at com.atlassian.bamboo.hibernate.ReadOnlyGetMethodEnforcer.onFlushDirty(ReadOnlyGetMethodEnforcer.java:58)	at org.springframework.orm.hibernate.support.ChainedInterceptorSupport.onFlushDirty(ChainedInterceptorSupport.java:112)	at org.hibernate.event.def.DefaultFlushEntityEventListener.invokeInterceptor(DefaultFlushEntityEventListener.java:372)	at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:349)	at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:287)	at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:155)	at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)	at java.lang.reflect.Method.invoke(Method.java:597)	at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1387)	at $Proxy358.flush(Unknown Source)	at com.atlassian.bamboo.build.BuildNumberGeneratorDaoImpl$1.doInHibernate(BuildNumberGeneratorDaoImpl.java:48)	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)	at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:341)	at com.atlassian.bamboo.build.BuildNumberGeneratorDaoImpl.generateBuildNumberNewTx(BuildNumberGeneratorDaoImpl.java:30)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)	at java.lang.reflect.Method.invoke(Method.java:597)	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)	at $Proxy140.generateBuildNumberNewTx(Unknown Source)	at com.atlassian.bamboo.build.BuildNumberGeneratorServiceImpl$1.call(BuildNumberGeneratorServiceImpl.java:35)	at com.atlassian.bamboo.build.BuildNumberGeneratorServiceImpl$1.call(BuildNumberGeneratorServiceImpl.java:31)	at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312)	at com.atlassian.bamboo.build.BuildNumberGeneratorServiceImpl.generateBuildNumber(BuildNumberGeneratorServiceImpl.java:30)	... 277 more
```


author: renatoliveira
body: I am having the same issue here. All my builds don't even start, with the following error popping to my screen:

```
Error encountered while triggering manual build: Could not generate next build number for 'PP-GET'Plan 'PP-GET' did not start
```

I think Atlassian updated Bamboo Cloud, and something went (really) wrong.


author: ralfhergert
body: Refering to the final answer of this issue <https://answers.atlassian.com/questions/18810282> it needs JavaScript to convert the XSRF into a proper POST request. I think this is the part which is currently failing. If you open up the development utilities in our browser, you will see, that on loading the bamboo pages some JavaScript-errors happen. They migth cause that the JavaScript conversion of the XSRF request is no longer done properly.


author: ralfhergert
body: We have the same issue. Underlying execeptions are:

```
java.lang.RuntimeException: Could not generate next build number for 'AR-HD'	at com.atlassian.bamboo.build.BuildNumberGeneratorServiceImpl.generateBuildNumber(BuildNumberGeneratorServiceImpl.java:41)	at com.atlassian.bamboo.v2.trigger.ManualBuildDetectionAction.generateResultWithoutChanges(ManualBuildDetectionAction.java:102)
```

```
Caused by: java.lang.IllegalStateException: XSRF: A mutative operation was attempted on DefaultChain within a non-mutative HTTP request: https://haz-h1.atlassian.net/builds/build/admin/ajax/startPlan.action?planKey=AR-HD : [[CHAIN, 2014-12-10 17:11:41.768, 2015-06-29 03:40:30.196, AR-HD, HD, HAZ Daily, HAZ Daily, 1, 236, 237, false, false, com.atlassian.bamboo.project.DefaultProject@c04, com.atlassian.bamboo.build.DefaultBuildDefinitionForBuild@6e7cb9bf, [com.atlassian.bamboo.labels.LabellingImpl@f984fff, com.atlassian.bamboo.labels.LabellingImpl@202e7dff], [], null, com.atlassian.bamboo.notification.NotificationSetImpl@b8003, [com.atlassian.bamboo.chains.ChainStageImpl@3abe2067]]]->->[[CHAIN, 2014-12-10 17:11:41.768, 2015-06-29 03:40:30.196, AR-HD, HD, HAZ Daily, HAZ Daily, 1, 237, 238, false, false, com.atlassian.bamboo.project.DefaultProject@c04, com.atlassian.bamboo.build.DefaultBuildDefinitionForBuild@6e7cb9bf, [com.atlassian.bamboo.labels.LabellingImpl@f984fff, com.atlassian.bamboo.labels.LabellingImpl@202e7dff], [], null, com.atlassian.bamboo.notification.NotificationSetImpl@b8003, [com.atlassian.bamboo.chains.ChainStageImpl@3abe2067]]]	at com.atlassian.bamboo.utils.XsrfUtils.fail(XsrfUtils.java:32)	at com.atlassian.bamboo.hibernate.ReadOnlyGetMethodEnforcer.fail(ReadOnlyGetMethodEnforcer.java:109)
```


Tags: bamboo-administration