A directory exists at the same location when creating repository

Troubleshooting Databases

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community


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

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


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


  • Shutdown Stash
  • Execute the following SQL against your Stash database

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

Was this helpful?

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