NumberFormatException on startup after update

Issue

After updating to
2.73.3 or
2.89 or later, Jenkins fails to start with an exception like:

SEVERE: Failed to initialize Jenkins
hudson.util.HudsonFailedToLoad: org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException
at hudson.WebAppMain$3.run(WebAppMain.java:250)
Caused by: org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException
at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:269)
at jenkins.InitReactorRunner.run(InitReactorRunner.java:47)
at jenkins.model.Jenkins.executeReactor(Jenkins.java:1099)
at jenkins.model.Jenkins.<init>(Jenkins.java:904)
at hudson.model.Hudson.<init>(Hudson.java:86)
at hudson.model.Hudson.<init>(Hudson.java:82)
at hudson.WebAppMain$3.run(WebAppMain.java:233)
Caused by: java.lang.Error: java.lang.reflect.InvocationTargetException
at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110)
at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
at jenkins.model.Jenkins$5.runTask(Jenkins.java:1065)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
... 8 more
Caused by: java.lang.NumberFormatException: For input string: "foob"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at jenkins.model.IdStrategy$CaseInsensitive.idFromFilename(IdStrategy.java:306)
at hudson.model.User$AllUsers.scanAll(User.java:1057)
... 13 more

Resolution

Within
$JENKINS_HOME/users/, locate the user directory that contains the input string specified in the above
NumberFormatException prefixed by a “$” (in the above example, a user containing the string “$foob”). Add 0024 after the “$”. For example, if the error string was “foob”, and you have a user directory called “mynameis$foobar”, you would rename the directory to “mynameis$0024foobar”. Do not alter any other parts of the directory name, even if there are additional “$” characters in the name. Restart your Jenkins instance, and repeat this rename as necessary.

More Information

This is caused by the resolution to SECURITY-499, which was disclosed in the Nov 8, 2017 security advisory and resolved in Jenkins LTS version
2.73.3 and Jenkins weekly release
2.89. This migrates user directories containing special characters to a directory without them. This did not, however, account for usernames containing a “$” beforehand. See also JENKINS-47909.