Bitbucket RepositoryMovedException
How to get rid of RepositoryMovedException for moved, rename or deleted repositories.
This issue is present only in the configuration rules created before our Bitbucket App became capable of updating configurations when a repository was moved or removed.
If you see in the Bitbucket logs similar exception it means you have a configuration rule for a repository which was renamed, moved or deleted. Read below the steps to fix this situation.
2020-12-08 06:09:10,060 ERROR [http-nio-7990-exec-21] moveworkforward @1MFI5PBx369x484351x0 grly04 10.10.1.1,127.0.0.1 "GET /plugins/servlet/bitbucket-webhooks/configuration/DO/rawhide-services HTTP/1.1" c.m.b.s.AbstractBitbucketConfigurationService The repository has been moved to MWF/the-magic-repo-new
com.atlassian.bitbucket.repository.RepositoryMovedException: The repository has been moved to MWF/the-magic-repo
at com.atlassian.stash.internal.repository.DefaultRepositorySupplier.getBySlug(DefaultRepositorySupplier.java:65)
at com.atlassian.stash.internal.repository.DefaultRepositorySupplier.getBySlug(DefaultRepositorySupplier.java:48)
at com.atlassian.stash.internal.repository.DefaultRepositorySupplier.getBySlug(DefaultRepositorySupplier.java:21)
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
There are 2 ways to fix this error. The first one is to remove the rule for the old repository key and the second one is to change the configuration rule repository key to the new repository key (works only for rename or move operations).
We propose to delete the rule following the steps below.
Here is an example how to call REST APIs of Bitbucket Server (works the same way for the 3rd party Apps).
Make sure you are the global administrator.
Get all configurations using GET http://localhost:7990/bitbucket/rest/webhook/2.0/configurations
Find the necessary repositories and not done the rule id
Delete the configuration for old repositories using DELETE http://localhost:7990/bitbucket/rest/webhook/2.0/configurations/{id} where id is the id of the rule.
Updated: