Unknown RepositoryDefinition Error Using Build Plan Branches
Asked by Matthew Smith:

Hi! I'm using build plan branches for the first time, and can't get it to work. When I attempt to run a build for my branch, I get the following error. Any help is appreciated.

System Error Details {#toc-hId-1842083777}
==========================================

Build [x](http://s.getsmartcontent.com).example.com - Build Serving - PROJ-1234-branch-name 1 : Plan 'XXX-XXX-1' started but a fatal error occurred   
(java.lang.IllegalArgumentException : Unknown RepositoryDefinition 9994243)

Occurred: 15 Dec 2015, 7:18:31 PM

*** ** * ** ***

```
java.lang.IllegalArgumentException: Unknown RepositoryDefinition 9994243	at com.atlassian.bamboo.v2.build.BuildChangesImpl.getBuildRepositoryChanges(BuildChangesImpl.java:213)	at com.atlassian.bamboo.v2.build.BuildChangesImpl.setPreviousVcsRevisionKey(BuildChangesImpl.java:92)	at com.atlassian.bamboo.plan.vcsRevision.PlanVcsRevisionHistoryManagerImpl.markBuildStartedNewTx(PlanVcsRevisionHistoryManagerImpl.java:60)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:497)	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 com.sun.proxy.$Proxy138.markBuildStartedNewTx(Unknown Source)	at com.atlassian.bamboo.plan.vcsRevision.PlanVcsRevisionHistoryServiceImpl$2.run(PlanVcsRevisionHistoryServiceImpl.java:53)	at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:321)	at com.atlassian.bamboo.plan.vcsRevision.PlanVcsRevisionHistoryServiceImpl.markBuildStarted(PlanVcsRevisionHistoryServiceImpl.java:48)	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:313)	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:224)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:497)	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.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)	at com.sun.proxy.$Proxy151.delayedStart(Unknown Source)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1$1.run(PlanExecutionManagerImpl.java:430)	at com.atlassian.bamboo.util.CacheAwareness$2.call(CacheAwareness.java:83)	at com.atlassian.bamboo.util.CacheAwareness$2.call(CacheAwareness.java:79)	at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:101)	at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:78)	at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:118)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.call(PlanExecutionManagerImpl.java:425)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.call(PlanExecutionManagerImpl.java:416)	at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312)	at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:85)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:801)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$400(PlanExecutionManagerImpl.java:128)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1.run(PlanExecutionManagerImpl.java:410)	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)	at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)	at java.lang.Thread.run(Thread.java:745)
```


Answers:
author: rsperafico
body: Hello Matthew,

Thank you for your inquire.

```
Unknown RepositoryDefinition 9994243
```

The error above related to the fact that at certain moment there was a repository with ID 9994243 and, for some reason (i.e.: deletion) the same is no longer available to the Plan you are attempting on running. That said, please:

1. make sure the repository exists under "*Bamboo administration \>\> Overview \>\> Build resources \>\> Linked repositories*" OR;
2. make sure there is a Repository set up under "*Plan configuration \>\> Repositories*" tab, and the repository in question is the one you want to Source Code Checkout from
3. make sure the same repository as above is selected under "*Plan configuration \>\> Branches \>\> \<YOUR_BRANCH\> \>\> Source Repository*"
4. make sure the "*Source Code Checkout*" task has the repository in question selected

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

---

Kind regards,  
Rafael P. Sperafico  
Atlassian Support

comments: author: Chitrarth Sahai
body: Hi,

I am facing the same issue and I have made sure the 4 points mentioned in your answer. I removed the linked repository and added it again as well. Still facing this issue.

Is this fixed? Any workaround for this?


author: m
body: Had the same problem today with 7.1.2.

The only way I could resolve it is to run a new custom build with the same params as the failing one (rebuilds didn't work)

Reference: [https://jira.atlassian.com/browse/BAM-18309?focusedCommentId=1525576\&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-1525576](https://jira.atlassian.com/browse/BAM-18309?focusedCommentId=1525576&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-1525576)


author: Liam
body: I am having the same issue, I am using bitbucket cloud as the repo source


author: Liam
body: Ok here is the symptoms and a quicker fix:  
1) build is queued  
2) build is not seen in the system build queue  
3) When build stopped, repo error will appear  
Fix:  
1) Create a linked repo with the settings but different name.  
2) swap it out with the default repo for the build plan.


Tags: cloud