jenkinsci / jenkinsci/gitlab-branch-source-plugin

[JENKINS-71955] GitLab branch source scan fails with null pointer exception if credentials are not provided

Open
#723 19 comments 0 reactions 0 assignees View on GitHub
component:gitlab-branch-source-plugin good first issue imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
134
Forks
113
PR merge metrics
No merged PRs in 30d

Description

A GitLab branch source project fails its initial scan with a null pointer exception. The message is:

```
Checking project markewaite-jenkins-plugins/tasks-pipeline
Proposing markewaite-jenkins-plugins/tasks-pipeline
ERROR: Failed to create or update a subproject markewaite-jenkins-plugins/tasks-pipeline
java.lang.NullPointerException: Cannot invoke "java.lang.Boolean.booleanValue()" because the return value of "org.gitlab4j.api.models.Project.getMergeRequestsEnabled()" is null
at io.jenkins.plugins.gitlabbranchsource.GitLabSCMSource.retrieve(GitLabSCMSource.java:334)
at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:372)
at jenkins.scm.api.SCMSource.fetch(SCMSource.java:326)
at jenkins.branch.MultiBranchProjectFactory$BySCMSourceCriteria.recognizes(MultiBranchProjectFactory.java:262)
at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.recognizes(OrganizationFolder.java:1361)
at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.complete(OrganizationFolder.java:1376)
at jenkins.scm.api.trait.SCMNavigatorRequest.process(SCMNavigatorRequest.java:252)
at jenkins.scm.api.trait.SCMNavigatorRequest.process(SCMNavigatorRequest.java:202)
at io.jenkins.plugins.gitlabbranchsource.GitLabSCMNavigator.visitSources(GitLabSCMNavigator.java:305)
at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:535)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:269)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:167)
at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:920)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)

```

The job definition is available as JENKINS-71955">job-definition.xml

---
Originally reported by markewaite, imported from: GitLab branch source scan fails with null pointer exception if credentials are not provided


  • assignee: the_jsc_
  • status: Open
  • priority: Major
  • component(s): gitlab-branch-source-plugin
  • label(s): newbie-friendly
  • resolution: Unresolved
  • votes: 0
  • watchers: 4
  • imported: 20251216-182730

Raw content of original issue

A GitLab branch source project fails its initial scan with a null pointer exception. The message is:


Checking project markewaite-jenkins-plugins/tasks-pipeline

Proposing markewaite-jenkins-plugins/tasks-pipeline
ERROR: Failed to create or update a subproject markewaite-jenkins-plugins/tasks-pipeline
java.lang.NullPointerException: Cannot invoke "java.lang.Boolean.booleanValue()" because the return value of "org.gitlab4j.api.models.Project.getMergeRequestsEnabled()" is null
at io.jenkins.plugins.gitlabbranchsource.GitLabSCMSource.retrieve(GitLabSCMSource.java:334)
at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:372)
at jenkins.scm.api.SCMSource.fetch(SCMSource.java:326)
at jenkins.branch.MultiBranchProjectFactory$BySCMSourceCriteria.recognizes(MultiBranchProjectFactory.java:262)
at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.recognizes(OrganizationFolder.java:1361)
at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.complete(OrganizationFolder.java:1376)
at jenkins.scm.api.trait.SCMNavigatorRequest.process(SCMNavigatorRequest.java:252)
at jenkins.scm.api.trait.SCMNavigatorRequest.process(SCMNavigatorRequest.java:202)
at io.jenkins.plugins.gitlabbranchsource.GitLabSCMNavigator.visitSources(GitLabSCMNavigator.java:305)
at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:535)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:269)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:167)
at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:920)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)

The job definition is available as job-definition.xml

environment

```
Jenkins: 2.414.1

OS: Linux - 6.4.0-3-amd64

Java: 21-beta - Eclipse Adoptium (OpenJDK 64-Bit Server VM)

---

PrioritySorter:5.0.0

adoptopenjdk:1.5

analysis-model-api:11.6.0

ant:497.v94e7d9fffa_b_9

antisamy-markup-formatter:162.v0e6ec0fcfcf6

apache-httpcomponents-client-4-api:4.5.14-208.v438351942757

authentication-tokens:1.53.v1c90fd9191a_b_

badge:1.9.1

basic-branch-build-strategies:81.v05e333931c7d

bootstrap5-api:5.3.0-1

bouncycastle-api:2.29

branch-api:2.1122.v09cb_8ea_8a_724

build-blocker-plugin:1.7.8

build-name-setter:2.3.0

build-timeout:1.31

buildresult-trigger:0.18

caffeine-api:3.1.8-133.v17b_1ff2e0599

checks-api:2.0.0

cloudbees-bitbucket-branch-source:832.v43175a_425ea_6

cloudbees-folder:6.848.ve3b_fd7839a_81

cloudbees-jenkins-advisor:358.v58972d19b_1f0

clover:4.13.0

code-coverage-api:4.7.0

command-launcher:107.v773860566e2e

commons-lang3-api:3.13.0-62.v7d18e55f51e2

commons-text-api:1.10.0-68.v0d0b_c439292b_

conditional-buildstep:1.4.3

config-file-provider:953.v0432a_802e4d2

configuration-as-code:1670.v564dc8b_982d0

copyartifact:722.v0662a_9b_e22a_c

credentials:1271.v54b_1c2c6388a_

credentials-binding:631.v861c06d062b_4

dark-theme:336.v02165cd8c2ee

data-tables-api:1.13.5-1

description-setter:1.10

display-url-api:2.3.9

docker-commons:439.va_3cb_0a_6a_fb_29

docker-workflow:572.v950f58993843

durable-task:523.va_a_22cf15d5e0

echarts-api:5.4.0-5

elastic-axis:464.va_7ed499b_9d75

embeddable-build-status:412.v09da_db_1dee68

envinject:2.908.v66a_774b_31d93

envinject-api:1.199.v3ce31253ed13

external-monitor-job:207.v98a_a_37a_85525

font-awesome-api:6.4.0-2

forensics-api:2.3.0

git:5.2.0

git-client:4.4.0

git-forensics:2.0.0

git-parameter:0.9.19

git-server:99.va_0826a_b_cdfa_d

gitea:1.4.5

github:1.37.3

github-api:1.314-431.v78d72a_3fe4c3

github-branch-source:1732.v3f1889a_c475b_

github-scm-filter-aged-refs:31.ve3b_ca_fc71d5b_

github-scm-trait-commit-skip:0.4.0

gitlab-api:5.3.0-91.v1f9a_fda_d654f

gitlab-branch-source:671.v67b_7169092ca_

gitlab-plugin:1.7.15

groovy-postbuild:2.5

h2-api:11.1.4.199-12.v9f4244395f7a_

handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953

http_request:1.18

ignore-committer-strategy:1.0.4

implied-labels:257.vc3c6a_ca_e563f

instance-identity:173.va_37c494ec4e5

ionicons-api:56.v1b_1c8c49374e

jackson2-api:2.15.2-350.v0c2f3f8fc595

jacoco:3.3.4

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-9

jaxb:2.3.8-1

jdk-tool:73.vddf737284550

jersey2-api:2.40-1

jira:3.10

jjwt-api:0.11.5-77.v646c772fddb_0

jquery3-api:3.7.0-1

jsch:0.2.8-65.v052c39de79b_2

junit:1217.v4297208a_a_b_ce

junit-realtime-test-reporter:129.vd45a_61b_e3a_c8

label-verifier:1.4

mailer:463.vedf8358e006b_

mapdb-api:1.0.9-28.vf251ce40855d

markdown-formatter:95.v17a_965e696ee

matrix-auth:3.2

matrix-project:808.v5a_b_5f56d6966

maven-plugin:3.23

metrics:4.2.18-442.v02e107157925

mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_

mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_

monitoring:1.95.0

naginator:1.19.2

nodelabelparameter:1.12.0

okhttp-api:4.11.0-157.v6852a_a_fa_ec11

parallel-test-executor:418.v24f9a_141d726

parameterized-trigger:2.46

pipeline-build-step:505.v5f0844d8d126

pipeline-github:2.8-147.3206e8179b1c

pipeline-github-lib:42.v0739460cda_c4

pipeline-graph-analysis:202.va_d268e64deb_3

pipeline-graph-view:198.v0844db_6ca_554

pipeline-groovy-lib:685.v8ee9ed91d574

pipeline-input-step:477.v339683a_8d55e

pipeline-maven:1330.v18e473854496

pipeline-milestone-step:111.v449306f708b_7

pipeline-model-api:2.2144.v077a_d1928a_40

pipeline-model-definition:2.2144.v077a_d1928a_40

pipeline-model-extensions:2.2144.v077a_d1928a_40

pipeline-stage-step:305.ve96d0205c1c6

pipeline-stage-tags-metadata:2.2144.v077a_d1928a_40

pipeline-utility-steps:2.16.0

plain-credentials:143.v1b_df8b_d3b_e48

platformlabeler:2095.ve47c8663f6a_b_

plugin-util-api:3.3.0

pollscm:1.5

preSCMbuildstep:71.v1f2990a_37e27

prism-api:1.29.0-7

promoted-builds:892.vd6219fc0a_efb

resource-disposer:0.23

run-condition:1.7

scm-api:676.v886669a_199a_a_

script-security:1275.v23895f409fb_d

snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4

ssh-agent:333.v878b_53c89511

ssh-credentials:308.ve4497b_ccd8f4

ssh-slaves:2.916.vd17b_43357ce4

sshd:3.312.v1c601b_c83b_0e

structs:325.vcb_307d2a_2782

support-core:1356.vd0f980edfa_46

swarm:3.40

testng-plugin:794.ve7e315837b_b_3

text-finder:1.26

theme-manager:211.vef2a_42c645a_b_

throttle-concurrents:2.14

timestamper:1.26

token-macro:384.vf35b_f26814ec

trilead-api:2.84.v72119de229b_7

variant:59.vf075fe829ccb

versioncolumn:162.v85841b_0790d5

view-job-filters:369.ve0513a_a_f5524

warnings-ng:10.4.0

workflow-aggregator:596.v8c21c963d92d

workflow-api:1267.vd9b_a_ddd9eb_47

workflow-basic-steps:1042.ve7b_140c4a_e0c

workflow-cps:3774.v4a_d648d409ce

workflow-durable-task-step:1289.v4d3e7b_01546b_

workflow-job:1342.v046651d5b_dfe

workflow-multibranch:756.v891d88f2cd46

workflow-scm-step:415.v434365564324

workflow-step-api:639.v6eca_cd8c04a_a_

workflow-support:848.v5a_383b_d14921

ws-cleanup:0.45

xshell:203.v80a_c62d7886f
```

2 attachments

- [Credentials-are-recommended.png](https://issues.jenkins.io/secure/attachment/62115/Credentials-are-recommended.png)
> ![Credentials-are-recommended.png](https://issues.jenkins.io/secure/attachment/62115/Credentials-are-recommended.png)
- [job-definition.xml](https://issues.jenkins.io/secure/attachment/61100/job-definition.xml)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.