Task 'Rebuilding Maven Metadata' execution failure

We use Nexus OSS 3.39.0-01

I have defined a a Task scheduled daily for Rebuild Maven repository metadata.

Bu we got the following task execution failure:

Task Name: Rebuild Maven repository metadata (maven-metadata.xml) - daily
Stack-trace:
org.sonatype.goodies.common.MultipleFailures$MultipleFailuresException: Failed to run task ‘Rebuilding Maven Metadata of *’; 1 failure
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: java.lang.NullPointerException
at org.sonatype.nexus.repository.maven.internal.hosted.metadata.MetadataBuilder.onExitBaseVersion(MetadataBuilder.java:256)
at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.rebuildBaseVersion(OrientMetadataRebuilder.java:407)
at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.lambda$4(OrientMetadataRebuilder.java:319)
at org.sonatype.nexus.transaction.OperationPoint.lambda$0(OperationPoint.java:53)
at org.sonatype.nexus.transaction.OperationPoint.proceed(OperationPoint.java:64)
at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:58)
at org.sonatype.nexus.transaction.Operations.proceedWithTransaction(Operations.java:232)
at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:219)
at org.sonatype.nexus.transaction.Operations.run(Operations.java:175)
at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder$OrientWorker.rebuildMetadataInner(OrientMetadataRebuilder.java:319)
at org.sonatype.nexus.repository.maven.internal.hosted.metadata.AbstractMetadataRebuilder$Worker.rebuildMetadata(AbstractMetadataRebuilder.java:232)
at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder.rebuildInTransaction(OrientMetadataRebuilder.java:130)
at org.sonatype.nexus.repository.maven.internal.orient.OrientMetadataRebuilder.rebuild(OrientMetadataRebuilder.java:112)
at org.sonatype.nexus.repository.maven.internal.orient.MavenHostedFacetImpl.rebuildMetadata(MavenHostedFacetImpl.java:118)
at org.sonatype.nexus.repository.maven.tasks.RebuildMaven2MetadataTask.execute(RebuildMaven2MetadataTask.java:60)
at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:79)
… 13 more

Reading this log I don’t understand what I have to analyze and how to fix the problem…

This seems to be an big with malformed artifact versions, it’s here sitting since a few month: [NEXUS-31231] Invalid snapshot version will cause Maven metadata rebuild process to fail with NullPointerException - Sonatype JIRA

There are also other NPEs in this area, which is quite unfortunate since it is especially important in critical restore situations… (as I learned last weekend ,)