diff --git a/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java b/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java index 2de41fc0ef371..91c32cfa4493e 100644 --- a/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java +++ b/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java @@ -650,6 +650,9 @@ public void endVerification(String seed) { public RepositoryData getRepositoryData() { try { final long indexGen = latestIndexBlobId(); + if (indexGen == RepositoryData.EMPTY_REPO_GEN) { + return RepositoryData.EMPTY; + } final String snapshotsIndexBlobName = INDEX_FILE_PREFIX + Long.toString(indexGen); RepositoryData repositoryData; @@ -688,9 +691,6 @@ public RepositoryData getRepositoryData() { } } return repositoryData; - } catch (NoSuchFileException ex) { - // repository doesn't have an index blob, its a new blank repo - return RepositoryData.EMPTY; } catch (IOException ioe) { throw new RepositoryException(metadata.name(), "could not read repository data from index blob", ioe); }