Failed to import job: "this.head" is null

Hi there. I’m trying to import a multibranch pipeline job folder from another server, and although job is created fine, it’s empty, without any branch inside. Checking logs, I see these errors (one of them per each branch):

2024-10-03 21:06:19.953+0000 [id=32]    WARNING c.c.h.p.folder.AbstractFolder#loadChildren: could not load /var/jenkins_home/jobs/folder/jobs/docker-images/branches/PR-100
java.lang.NullPointerException: Cannot invoke "jenkins.scm.api.SCMHead.getName()" because "this.head" is null

Destination Jenkins instance is running on a Kubernetes cluster inside EKS, and Jenkins root filesystem is an EFS mount.

I’ve search about this issue, but no specific info appears. Also, I see scm-api plugin is installed. Any idea to check?

Jenkins setup:

Jenkins: 2.462.1
OS: Linux - 5.10.214-202.855.amzn2.x86_64
Java: 17.0.12 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
Office-365-Connector:4.20.0
ace-editor:1.1
ansicolor:1.0.4
ant:497.v94e7d9fffa_b_9
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
aqua-security-scanner:3.2.4
artifactory:3.18.12
atlassian-bitbucket-server-integration:4.0.0
authentication-tokens:1.4
aws-credentials:218.v1b_e9466ec5da_
aws-java-sdk-ec2:1.12.586-413.v6a_6c3a_420126
aws-java-sdk-minimal:1.12.586-413.v6a_6c3a_420126
aws-java-sdk-secretsmanager:1.12.529-406.vdeff15e5817d
aws-secrets-manager-credentials-provider:1.213.vca_3f37306fed
aws-secrets-manager-secret-source:1.72.v61781b_35c542
basic-branch-build-strategies:81.v05e333931c7d
bootstrap5-api:5.3.0-1
bouncycastle-api:2.29
branch-api:2.1152.v6f101e97dd77
build-timeout:1.31
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.0.0
cloudbees-folder:6.858.v898218f3609d
command-launcher:107.v773860566e2e
commons-httpclient3-api:3.1-3
commons-lang3-api:3.13.0-62.v7d18e55f51e2
commons-text-api:1.10.0-36.vc008c8fcda_7b_
config-file-provider:959.vcff671a_4518b_
configuration-as-code:1670.v564dc8b_982d0
conjur-credentials:1.0.12
credentials:1311.vcf0a_900b_37c2
credentials-binding:642.v737c34dea_6c2
display-url-api:2.3.9
docker-commons:419.v8e3cd84ef49c
docker-workflow:572.v950f58993843
durable-task:523.va_a_22cf15d5e0
ec2:1648.vf3d852e00486
echarts-api:5.4.0-5
font-awesome-api:6.3.0-2
git:5.2.1
git-client:4.6.0
git-server:117.veb_68868fa_027
gradle:1.15
gson-api:2.10.1-15.v0d99f670e0a_7
instance-identity:142.v04572ca_5b_265
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.15.3-372.v309620682326
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javadoc:243.vb_b_503b_b_45537
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-10
jaxb:2.3.9-1
jdk-tool:73.vddf737284550
jersey2-api:2.39.1-2
jira:3.12
jobConfigHistory:1229.v3039470161a_d
joda-time-api:2.12.5-5.v5495a_235fedf
jquery-detached:1.2.1
jquery3-api:3.7.0-1
jsch:0.1.55.2
junit:1240.vf9529b_881428
ldap:701.vf8619de9160a_
mailer:463.vedf8358e006b_
mask-passwords:173.v6a_077a_291eb_5
matrix-auth:3.2.2
matrix-project:822.824.v14451b_c0fd42
maven-plugin:3.22
metrics:4.2.18-442.v02e107157925
mina-sshd-api-common:2.11.0-86.v836f585d47fa_
mina-sshd-api-core:2.11.0-86.v836f585d47fa_
monitoring:1.95.0
multibranch-build-strategy-extension:51.v88f14e2a_4075
node-iterator-api:49.v58a_8b_35f8363
oic-auth:4.257.v5360e8489e8b_
okhttp-api:4.11.0-157.v6852a_a_fa_ec11
pipeline-build-step:505.v5f0844d8d126
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-graph-view:215.vc0ea_557e4d6f
pipeline-groovy-lib:689.veec561a_dee13
pipeline-input-step:477.v339683a_8d55e
pipeline-milestone-step:101.vd572fef9d926
pipeline-model-api:2.2175.v76a_fff0a_2618
pipeline-model-definition:2.2168.vf921b_4e72c73
pipeline-model-extensions:2.2168.vf921b_4e72c73
pipeline-rest-api:2.33
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2168.vf921b_4e72c73
pipeline-stage-view:2.33
pipeline-utility-steps:2.16.0
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.3.0
prometheus:763.vf8c26b_a_34b_d6
resource-disposer:0.21
role-strategy:689.v731678c3e0eb_
scm-api:683.vb_16722fb_b_80b_
script-security:1336.vf33a_a_9863911
snakeyaml-api:2.2-111.vc6598e30cc65
sonar:2.16.1
ssh-credentials:308.ve4497b_ccd8f4
sshd:3.303.vefc7119b_ec23
structs:325.vcb_307d2a_2782
timestamper:1.26
token-macro:384.vf35b_f26814ec
trilead-api:2.141.v284120fd0c46
variant:59.vf075fe829ccb
workflow-aggregator:596.v8c21c963d92d
workflow-api:1283.v99c10937efcb_
workflow-basic-steps:1042.ve7b_140c4a_e0c
workflow-cps:3837.v305192405b_c0
workflow-cps-global-lib:588.v576c103a_ff86
workflow-durable-task-step:1313.vcb_970b_d2a_fb_3
workflow-job:1385.vb_58b_86ea_fff1
workflow-multibranch:756.v891d88f2cd46
workflow-scm-step:415.v434365564324
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:865.v43e78cc44e0d
ws-cleanup:0.45

Hello and welcome to this community, @eduararley. :wave:

The error java.lang.NullPointerException: Cannot invoke "jenkins.scm.api.SCMHead.getName()" because "this.head" is null indicates that Jenkins is trying to access a branch head that is not properly initialized. This can happen due to various reasons, such as corrupted job configurations or issues with the SCM API plugin.

Here are some steps that may help troubleshoot and resolve this issue:

  1. Make sure that you are using the latest version of the SCM API plugin. Sometimes, updating the plugin can resolve such issues. :person_shrugging:
  2. Try re-indexing the multibranch pipeline job. This can force Jenkins to re-scan the branches and might resolve the issue. :crossed_fingers:
    . Go to the multibranch pipeline job page.
    . Click on “Scan Repository Now”.
  3. Verify that the job configurations are correctly imported and not corrupted. You can try re-importing the job configurations.
  4. Sometimes, clearing the Jenkins cache can help resolve such issues. You could delete the contents of the jarCache directory on the Jenkins agents.
    rm -rf /var/jenkins_home/caches/jarCache/*
  5. Look for any additional errors or warnings in the Jenkins logs that might provide more context about the issue. :eyes:
  6. If the above steps do not resolve the issue, you could try recreating the multibranch pipeline job from scratch.