Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38259

"IllegalArgumentException: folder must not be null" when cloning vm

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Trivial Trivial
    • vsphere-cloud-plugin
    • None
    • Jenkins 2.21
      vSphere Plugin 2.13

      While trying to create a new clone / slave, instead of the vm being cloned, the following error is being thrown:

      Provisioned agent MacOS10.10Slave-1 failed to launch
      org.jenkinsci.plugins.vsphere.tools.VSphereException: java.lang.IllegalArgumentException: folder must not be null.
      at org.jenkinsci.plugins.vsphere.tools.VSphere.cloneOrDeployVm(VSphere.java:169)
      at org.jenkinsci.plugins.vsphere.tools.VSphere.cloneVm(VSphere.java:129)
      at org.jenkinsci.plugins.vSphereCloudSlaveTemplate.provision(vSphereCloudSlaveTemplate.java:250)
      at org.jenkinsci.plugins.vSphereCloud$1.call(vSphereCloud.java:274)
      at org.jenkinsci.plugins.vSphereCloud$1.call(vSphereCloud.java:272)
      at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      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:745)
      Caused by: java.lang.IllegalArgumentException: folder must not be null.
      at com.vmware.vim25.mo.VirtualMachine.cloneVM_Task(VirtualMachine.java:164)
      at org.jenkinsci.plugins.vsphere.tools.VSphere.cloneOrDeployVm(VSphere.java:158)
      ... 9 more

      I tracked down in the source where this was happening, and it looks like this line is the problem:

      Task task = sourceVm.cloneVM_Task((Folder) sourceVm.getParent(),
      cloneName, cloneSpec);

      So – "(Folder) sourceVm.getParent()" is returning null, and then the cloneVM_Task() function is checking that the folder is not null, and throwing this error.

      I am not sure under what circumstances .getParent() on the source VM is allowed to be null – other clones of this same vm by the same ID, under similar api restraints is working fine – its only failing in our Jenkins instance with the above stack trace.

            Unassigned Unassigned
            gregcovertsmith Greg Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: