Bitbucket Data Center shows error "The command to create the repository '<repo-name>' failed" while creating new repository
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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
While trying to create a new repository on Bitbucket Data Center UI, there's an error message on the UI saying "The command to create the repository '<repo-name>' failed. Please check the logs for more information (error: CommandFailedException)
.".
Environment
Bitbucket version 8.0+
Remote Mesh Nodes
Diagnosis
The Bitbucket application logs show the below:
2024-06-05 10:01:53,846 DEBUG [https-jsse-nio-8443-exec-17] <username> @1B4XFC3x601x176014x0 pbp0r3 10.xx.xxx.xxx,10.xxx.xx.xx "POST /projects/A13/repos HTTP/1.1" c.a.s.i.r.DefaultRepositoryService Could not create repository A13/test
com.atlassian.bitbucket.ServerException: The command to create the repository 'test' failed. Please check the logs for more information (error: CommandFailedException).
at com.atlassian.stash.internal.repository.DefaultRepositoryService.stripLocation(DefaultRepositoryService.java:1258)
The Mesh application logs for the corresponding request ID shows the below:
2024-06-05 10:01:35,510 WARN [grpc-server:thread-597] <username> 69JP7U3Vx601x484x2 @1B4XFC3x601x176014x0 10.xx.xxx.xxx "RepositoryService/Create" (>1 <0) c.a.b.m.t.LocalTransactionLeader [n/146/tx/195de1f2000000000000001a] Removed 10.xxx.xx.xx@147 from the write lock because it failed to prepare
io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
at io.grpc.Status.asRuntimeException(Status.java:535)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: io.netty.channel.ConnectTimeoutException: connection timed out: /10.xxx.xx.xx:7777
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:261)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
... 1 common frames omitted
Cause
The error above indicates possible network issues connecting to the Remote Mesh Nodes. Check the network connectivity between these nodes.
Solution
Fix the Remote Mesh Node's interconnectivity so all Mesh nodes can talk to each other and then writes can happen without issues.
For Bitbucket hosted on AWS
Make sure the port 7777 is added to both the Inbound and Outbound rules in the AWS Security groups for the Mesh nodes