There is 1 update, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-3119d561-a7fe-4d63-8d94-89d25829d54f XWIKI-25602 Open

"Failed to get remote extension from repository" NPE warning after starting an XWiki instance

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-fc117135-17ba-4f71-9df0-e52863177f62 Changes by Simon Urli on 29/Oct/26 08:57
 
Assignee: Simon Urli
 
 

1 comment

 
cid:jira-generated-image-avatar-fc117135-17ba-4f71-9df0-e52863177f62 Simon Urli on 29/Oct/26 09:07
 

Analysis

Root cause: one extension returned by the extensions.xwiki.org search has no version, and the client fails on it.

  1. ExtensionIndexJob.addRemoteExtensions() pages through the remote repository 100 extensions at a time with Searchable.search("", offset, 100).
  2. In xwiki-commons, XWikiExtensionRepository turns every search hit into a new XWikiExtension(...), which starts with factory.getVersion(restExtension.getVersion()).
  3. For a hit without <version> this is ExtensionFactory.getVersion(null): the lookup misses, then versions.put(null, ...) is called.
  4. SoftCache is backed by commons-collections4 ReferenceMap, whose put does Objects.requireNonNull(key, "key"), hence NullPointerException: key.
  5. The exception escapes search() for the whole page and is caught per repository in ExtensionIndexJob, which logs the warning and stops processing that repository.

The bad data: among the 730 hits of https://extensions.xwiki.org/xwiki/rest/repository/search, only org.xwiki.platform:xwiki-platform-image-style-rest (offset 500-599) has no <version>. Its other properties are fine (maven.Model says 18.8.0) and its /versions endpoint lists 213 versions, but https://extensions.xwiki.org/xwiki/rest/repository/extensions/org.xwiki.platform%3Axwiki-platform-image-style-rest returns an HTTP 500 ("An Entity Reference name cannot be null or empty"). So its lastVersion property appears to be empty on the server. This is why older XWiki versions are affected too: the client weakness is old, the trigger is new data on extensions.xwiki.org.

Impact: more than log noise. The page containing that extension and all the following ones are never processed, so about 230 remote extensions (offsets 500-729) are never added to the index, and their recommended/rating/support plan information is never updated, on every instance using extensions.xwiki.org.

Possible fixes

  • Immediate workaround on extensions.xwiki.org: re-import/update xwiki-platform-image-style-rest so that its lastVersion is set again. This removes the warning everywhere without a release.
  • Client (xwiki-commons, the real fix): in XWikiExtensionRepository search, skip and log hits with a blank id or version instead of letting one entry fail the whole page.
  • Indexer (platform, optional hardening): a failure on one page should not stop the processing of the remaining pages.
  • Server (platform, optional): RepositoryManager only checks the last version when it is not blank, so an extension with an empty lastVersion is still considered valid and is returned by the search. It should probably be treated as invalid, or its last version recomputed. Why the 18.8.0 import left it empty is still unexplained.