Jobs are missing in the UI with ArrayIndexOutOfBoundsException

Article ID:360054884952
1 minute readKnowledge base

Issue

You have a folder that is missing all of its jobs and:

  • You notice the jobs are still on the filesystem and they’re still being built.

  • You’re getting an angry Jenkins screen when trying to access to the jobs on the UI.

  • You’re getting the following error on the logs:

java.lang.ArrayIndexOutOfBoundsException: 0
    at java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:388)
    at java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:397)
    at hudson.model.ViewGroupMixIn.getPrimaryView(ViewGroupMixIn.java:173)
    at jenkins.model.Jenkins.getPrimaryView(Jenkins.java:1888)
    at hudson.model.View.isDefault(View.java:428)
    at hudson.model.AbstractItem.getUrl(AbstractItem.java:552)
    at hudson.model.AbstractItem.getUrl(AbstractItem.java:570)
Caused: java.lang.reflect.InvocationTargetException

Resolution

This issue is caused by an assumption of an existing view on Jenkins core.

Update your product to the higher version as possible but not older than 2.204.2.2 as it will include the fix for this issue implemented on Jenkins core 2.206.

Workaround

To work around it, you can create a Dashboard view with the following configuration:

  • Check using Recurse in subfolders.

  • Check Use a regular expression to include jobs into the view and set it to .*.

This will provide you with a view that is showing up this specific folder content.