Nexus - IndexNotFoundException[no such index] - (version: OSS 3.29.2-02)

Hi,

I’m receiving an error when searching in a repo using the rest api. Its working fine when browsing the same repo. Meaning I see hte file correctly.

Rest call:
https://{servername}/service/rest/v1/search/assets?sort=name&repository=myRepo-1
Gives error:
ERROR: (ID 8fbef213-885c-4062-8388-c62365e8214f) [e33dc7fb71e43c3ff3352d5030faced30995119a] IndexNotFoundException[no such index]

I’ve already tried to rebuild the index but without success. using tasks:

  • Repair - Rebuild repository search (this fails always)
  • Repair - Rebuild repository browse (gives ok)
    Before running the tasks I cleaned up the “elasticsearch” folder but after the run the index error occurred again.

The “repair search” task fails with error (invalid state):
4a278390-5328-4af5-8494-cd28275178da : ‘Repair - Rebuild repository search’ [repository.rebuild-index] execution failure
org.sonatype.goodies.common.MultipleFailures$MultipleFailuresException: Failed to run task ‘Rebuilding search index of *’; 2 failures
at org.sonatype.goodies.common.MultipleFailures.maybePropagate(MultipleFailures.java:95)
at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:90)
at org.sonatype.nexus.scheduling.TaskSupport.call(TaskSupport.java:100)
at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.doExecute(QuartzTaskJob.java:143)
at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.execute(QuartzTaskJob.java:106)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.sonatype.nexus.quartz.internal.QuartzThreadPool.lambda$0(QuartzThreadPool.java:145)
at org.sonatype.nexus.thread.internal.MDCAwareRunnable.run(MDCAwareRunnable.java:40)
at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120)
at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Suppressed: org.sonatype.nexus.common.stateguard.InvalidStateException: Invalid state: DELETED; allowed: [STARTED]
at org.sonatype.nexus.common.stateguard.StateGuard._ensure(StateGuard.java:115)
at org.sonatype.nexus.common.stateguard.StateGuard.access$1(StateGuard.java:108)
at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:271)
at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:54)
at org.sonatype.nexus.repository.search.index.RebuildIndexTask.execute(RebuildIndexTask.java:33)
at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:79)
… 13 common frames omitted
Suppressed: java.lang.NullPointerException: null
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:878)
at org.sonatype.nexus.repository.storage.BlobTx.(BlobTx.java:64)
at org.sonatype.nexus.repository.storage.StorageFacetImpl.openStorageTx(StorageFacetImpl.java:300)
at org.sonatype.nexus.repository.storage.StorageFacetImpl.lambda$0(StorageFacetImpl.java:163)
at org.sonatype.nexus.transaction.UnitOfWork.doOpenSession(UnitOfWork.java:247)
at org.sonatype.nexus.transaction.UnitOfWork.openSession(UnitOfWork.java:222)
at org.sonatype.nexus.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:54)
at org.sonatype.nexus.repository.search.SearchFacetImpl.rebuildIndex(SearchFacetImpl.java:115)
at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:272)
at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:54)
at org.sonatype.nexus.repository.search.index.RebuildIndexTask.execute(RebuildIndexTask.java:33)
at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:79)
… 13 common frames omitted
2022-08-31 13:40:23,058+0200 INFO [quartz-8-thread-11] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task ‘Repair - Rebuild repository search’ [repository.rebuild-index] state change RUNNING → WAITING (FAILED)

Note: I have also an issue with deleting some old repo’s that are in a state “FAILED”.
I’m not sure if both issues are related to each other.

Nobody of Nexus knows how to resolve this???

Have you looked at the logs to see if any internal errors are being thrown when you hit the api endpoint? Also what version of nexus are you running and (3.29?) what type of repository is this?

Note that the expected behavior when you hit a non existing repo is not the error you list but:

{
  "items" : [ ],
  "continuationToken" : null
}

I would try hitting the end point with other repos and or a fake one like MyFancyRepo to see if the server behaves as expected. This way you can tell if the problem is specific to the one repository and some sort of corruption within your storage or the problem is more of a server wide misconfiguration. Also worth asking is this repo local or blob store?