A directory exists at the same location when creating repository

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Creating a repository fails with an error that a directory exists at the same location and the following appears in the atlassian-bitbucket-YYYY-MM-DD.log:

2014-09-18 23:16:27,865 DEBUG [http-bio-7990-exec-169] user @1WE6GQ3x1396x14813x0 76eaji 10.10.255.179,127.0.0.1 "POST /projects/PROJ/repos HTTP/1.1" c.a.s.i.w.a.RepositoryAdminController Exception occurred
com.atlassian.bitbucket.repository.IllegalRepositoryStateException: Cannot create repository platform-core at /var/atlassian/application-data/bitbucket/shared/data/repositories/15; a directory exists at the same location

Cause

The sequence number used for the next repository ID has become out of sync between the database and file system.

Resolution

  • Shutdown Bitbucket Server
  • Execute the following SQL against your Bitbucket Server database

    UPDATE id_sequence
    SET next_val = (select max(id) from repository) + 20
    WHERE sequence_name = 'repository';
  • Start Bitbucket Server
Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.