'Get a NullPointerException in MultiSCMRevisionState.get, Jenkins checkout step preceded by a warning

I created a job and trying to checkout a Repo using checkout into a custom workspace.

checkout(
        changelog: true,
        scm: [
               $class: 'GitSCM', 
               branches: [[name: '*/<branch-name>']], 
               extensions: [[$class: 'RelativeTargetDirectory', 
                             relativeTargetDir: '<directory-name>']], 
               gitTool: 'Default', 
               userRemoteConfigs: [[credentialsId: '<credentialsId>', 
               url: '<git-repo-url>.git']]
        ]
)

Get a Warning in the step as below:

[2022-03-18T09:55:36.231Z] WARNING: Unknown parameter(s) found for class type 'org.jenkinsci.plugins.workflow.steps.scm.GenericSCMStep': GIT_AUTHOR_EMAIL,GIT_AUTHOR_NAME,GIT_BRANCH,GIT_CHECKOUT_DIR,GIT_COMMIT,GIT_COMMITTER_EMAIL,GIT_COMMITTER_NAME,GIT_PREVIOUS_COMMIT,GIT_URL

The build fails with the below error...

[2022-03-18T09:55:36.296Z] java.lang.NullPointerException
[2022-03-18T09:55:36.296Z]  at org.jenkinsci.plugins.workflow.steps.scm.MultiSCMRevisionState.get(MultiSCMRevisionState.java:56)
[2022-03-18T09:55:36.296Z]  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
[2022-03-18T09:55:36.296Z]  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
[2022-03-18T09:55:36.296Z]  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
[2022-03-18T09:55:36.296Z]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[2022-03-18T09:55:36.296Z]  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2022-03-18T09:55:36.296Z]  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2022-03-18T09:55:36.296Z]  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[2022-03-18T09:55:36.296Z]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[2022-03-18T09:55:36.296Z]  at java.lang.Thread.run(Thread.java:745)
[2022-03-18T09:55:36.303Z] Finished: FAILURE



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source