Skip to content

NPE in GitSCM.onLoaded() on startup: descriptor is null when calling getOldGitExe() #3935

@meetgoti07

Description

@meetgoti07

Jenkins and plugins versions report

Environment
apache-httpcomponents-client-4-api:4.5.14-269.vfa_2321039a_83
asm-api:9.9.1-189.vb_5ef2964da_91
bouncycastle-api:2.30.1.83-289.v8426fcd19371
caffeine-api:3.2.3-194.v31a_b_f7a_b_5a_81
commons-lang3-api:3.20.0-109.ve43756e2d2b_4
commons-text-api:1.15.0-218.va_61573470393
credentials:1491.v6d6145e96e1c
credentials-binding:717.v951d49b_5f3a_a_
display-url-api:2.217.va_6b_de84cc74b_
git:5.10.0
git-client:6.5.0
gson-api:2.13.2-173.va_a_092315913c
instance-identity:203.v15e81a_1b_7a_38
ionicons-api:94.vcc3065403257
jakarta-activation-api:2.1.4-1
jakarta-mail-api:2.1.5-1
mailer:525.v2458b_d8a_1a_71
mina-sshd-api-common:2.16.0-167.va_269f38cc024
mina-sshd-api-core:2.16.0-167.va_269f38cc024
plain-credentials:199.v9f8e1f741799
scm-api:728.vc30dcf7a_0df5
script-security:1399.ve6a_66547f6e1
ssh-credentials:361.vb_f6760818e8c
structs:362.va_b_695ef4fdf9
variant:70.va_d9f17f859e0
workflow-scm-step:466.va_d69e602552b_
workflow-step-api:710.v3e456cc85233

What Operating System are you using (both controller, and any agents involved in the problem)?

Controller: macOS 15.2 (darwin 25.2.0), Apple Silicon
Agents: none involved (single-node setup)

Reproduction steps

Build Jenkins core from source (current main branch, version 2.1328.vfd10e2339a_19).
Start Jenkins using mvn -pl war jetty:run from the Jenkins core workspace.
Install Git plugin 5.10.0 and Git client plugin 6.5.0 via Manage Jenkins → Plugins (or place the .jpi files in JENKINS_HOME/plugins/).
Restart Jenkins.

Expected Results

Jenkins starts successfully. The Git plugin initializes without error and is available for use.

Actual Results

Jenkins fails to start with a NullPointerException in GitSCM.onLoaded(), causing HudsonFailedToLoad:

java.lang.NullPointerException: Cannot invoke "hudson.plugins.git.GitSCM$DescriptorImpl.getOldGitExe()" because "desc" is null
    at hudson.plugins.git.GitSCM.onLoaded(GitSCM.java:2174)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
Caused: java.lang.reflect.InvocationTargetException
    ...
Caused: java.lang.Error
    at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:115)
    at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:185)
    ...
Caused: org.jvnet.hudson.reactor.ReactorException
    ...
Caused: hudson.util.HudsonFailedToLoad
    at hudson.WebAppMain$3.run(WebAppMain.java:274)

Anything else?

Root cause: GitSCM.onLoaded() is called as a plugin initializer before GitSCM's descriptor (GitSCM$DescriptorImpl) has been registered by the extension system. The method then calls desc.getOldGitExe() on a null desc, crashing startup. This appears to be an initializer ordering issue exposed by changes in the Jenkins core development version.

Are you interested in contributing a fix?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions