The operation could not be performed because the object is in an invalid state error occurs when removing a vApp in VMware Cloud Director
search cancel

The operation could not be performed because the object is in an invalid state error occurs when removing a vApp in VMware Cloud Director

book

Article ID: 418237

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • A vApp cannot be removed from VMware Cloud Director due to errors similar to the one below:

    The operation could not be performed because the object is in an invalid state.
    vCenter Server task (moref: task-#######) failed in vCenter Server '#######'

  • In the underlying vCenter environment, virtual machines still appear in the folder associated with the vApp that no longer appear to be part of the vApp in the VMware Cloud Director user interface.
  • The virtual machines in the vCenter are in an orphaned state and no longer exist in storage to be re-imported.
  • In the VMware Cloud Director logs, an error similar to the following is seen:

    2025-11-10 14:03:40,272 | ERROR    | Backend-activity-pool-1798 | DeleteVappActivity             | [Activity Execution] Uncaught Exception during Activity execution. Recent phase: com.vmware.vcloud.vdc.impl.DeleteVappActivity$ProcessVAppStrandedItemsPhase@2939cbe0 - Handle: urn:uuid:########-####-####-####-############, Current Phase: DeleteVappActivity$ProcessVAppStrandedItemsPhase | requestId=########-####-####-####-############,request=DELETE https://####/api/admin/vdc/########-####-####-####-############,requestTime=1762783415844,remoteAddress=###.###.###.###:20398,userAgent=...,accept=application/*+json;version 40.0.0-alpha vcd=########-####-####-####-############,task=########-####-####-####-############ activity=(com.vmware.vcloud.backendbase.management.system.TaskActivity,urn:uuid:########-####-####-####-############) activity=(com.vmware.vcloud.valc.activities.DeleteVdcActivity,urn:uuid:########-####-####-####-############) vcd=########-####-####-####-############,task=########-####-####-####-############ activity=(com.vmware.vcloud.backendbase.management.system.TaskActivity,urn:uuid:########-####-####-####-############) activity=(com.vmware.vcloud.vdc.impl.DeleteVappActivity,urn:uuid:########-####-####-####-############)
    java.util.concurrent.ExecutionException: com.vmware.ssdc.library.exceptions.VimInvalidStateException: The operation could not be performed because the object is in an invalid state.
    vCenter Server task (moref: task-#######) failed in vCenter Server '#######' (########-####-####-####-############).
            at com.vmware.vcloud.activity.executors.ActivityRunner.run(ActivityRunner.java:136)
            at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
            at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
            at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
            at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
            at java.base/java.lang.Thread.run(Thread.java:829)
    Caused by: com.vmware.ssdc.library.exceptions.VimInvalidStateException: The operation could not be performed because the object is in an invalid state.
    vCenter Server task (moref: task-#######) failed in vCenter Server '#######' (########-####-####-####-############).
            at com.vmware.ssdc.library.vim.LmVim.Convert(LmVim.java:362)
            at com.vmware.ssdc.library.vim.LmVim.Convert(LmVim.java:504)
            at com.vmware.vcloud.val.taskmanagement.TaskWaiterInvRecord.CheckForError(TaskWaiterInvRecord.java:176)
            at com.vmware.vcloud.val.internal.impl.FolderManagerImpl.renameEntity(FolderManagerImpl.java:223)
            at com.vmware.vcloud.val.internal.impl.FolderManagerImpl.renameItemsBeforeMoving(FolderManagerImpl.java:200)
            at com.vmware.vcloud.val.internal.impl.FolderManagerImpl.moveFolderItemsToAlternateFolder(FolderManagerImpl.java:154)
            at com.vmware.vcloud.vdc.impl.DeleteVappActivity$ProcessVAppStrandedItemsPhase.invoke(DeleteVappActivity.java:336)
            at com.vmware.vcloud.activity.executors.ActivityRunner.runPhase(ActivityRunner.java:175)
            at com.vmware.vcloud.activity.executors.ActivityRunner.run(ActivityRunner.java:112)
            ... 5 more
    Caused by: (vim.fault.InvalidState) {
       faultCause = null,
       faultMessage = (vmodl.LocalizableMessage) [
          (vmodl.LocalizableMessage) {
             dynamicType = null,
             dynamicProperty = null,
             key = com.vmware.vim.vpxd.vm.connectionState,
             arg = (vmodl.KeyAnyValue) [
                (vmodl.KeyAnyValue) {
                   dynamicType = null,
                   dynamicProperty = null,
                   key = connectionState,
                   value = orphaned
                }
             ],
             message = The VM is in orphaned state.
          }
       ]
    }
    ...

Environment

VMware Cloud Director 10.6.x

Cause

Even though the virtual machines are no longer directly associated with the vApp in VMware Cloud Director, it is attempting to remove all outstanding items it is finding in the underlying inventory based on the vApp folder, but cannot complete the process since vCenter us unable to perform the requested tasks on the orphaned VMs.

Resolution

In order to remove the vApp experiencing this issue from VMware Cloud Director, perform the following:

  1. Identify the folder for the vApp in the underlying vCenter inventory.
  2. Remove the associated orphaned VM(s) from the inventory in vCenter.
  3. Attempt removing the vApp once more.

Additional Information

For more information regarding orphaned VMs, please refer to the following article:

Virtual machines appear as invalid or orphaned or inaccessible