
In this tutorial, I will explain how to delete a virtual machine from the command line that cannot be deleted through the GUI.
To perform a test I mounted a CIFS storage where I added a virtual machine, once the test was done I deleted the storage in Proxmox without removing the VM.
When I tried to delete the VM (102), in the task area, I got the following error: Error: storage ‘XXXX’ does not exist.

To delete the VM, you must do it from the Shell by deleting the configuration file.
Go to folder /etc/pve/qemu-server
:

As we can see, we find the configuration of the virtual machines.
Here is the content of VM 102 which cannot be deleted.

The virtual disk that is on the scsi0 controller is no longer accessible.
To delete the VM, we will simply delete the file:
rm 102.conf

Adapt the order to your situation.
Once the file, returning to the web interface, we can see that VM 102 is deleted.

You know how to delete a VM from the command line on Proxmox.