Edit a VM’s Properties When There’s an Unhandled Exception in ESXi 6.5 Web Client

If you’ve ever had a physical VMware ESXi server with an external USB drive attached to it, and then tried moving the VM that was connected to that USB drive from that server to a new ESXi 6.5 server, you’ve probably noticed that trying to edit the VM’s properties on the new server is impossible – even if the old USB drive is connected to the new server. The browser begins to display the settings page, but just as it’s about to finish rendering it, it suddenly goes gray with an “unhandled exception” that requires you to reload the page and start over. Here’s how to get around that, so you can edit the properties of your VM and move on with your life…

In my specific case, I was working on a stand-alone test server running VMware 5.0, which had two different VMs, each connected to their own external USB drive. I wanted to put the hard drives containing the datastores containing these VMs in my new ESXi 6.5 server, so I gracefully shut down the VMs and the old VMware server. Then, I removed the hard drive and plugged it into the new 6.5 server. When I booted up the 6.5 server, it had no trouble seeing the old datastores, and the old VMs were all easily added to the inventory. However, when I tried editing the settings of either of the VMs that previously had external USB drives connected, I got an “unhandled exception” error, making viewing or changing the VMs’ properties impossible. This was the case if I connected to the server using current versions of Firefox, Chrome, or IE, in Windows or Linux. Here’s the error:

Screen Shot of the Error

Unhandled exception
Cause: TypeError: Cannot read property ‘push’ of undefined
Version: 1.8.0
Build: 4516221
ESXi: 6.5.0
Browser: Mozilla…..
Exception stack:
TypeError: Cannot read property ‘push’ of undefined
    at https://192.168.11.6/ui/scripts/main.js:315:15515
    at https://192.168.11.6/ui/scripts/main.js:265:23107
    at e (https://192.168.11.6/ui/scripts/main.js:264:5646)
    at https://192.168.11.6/ui/scripts/main.js:264:7652

Fixing it is easy. Just power off your VM and browse to the VM’s folder in your datastore and download the .VMX file. Make a backup copy of it and then open it in a text editor and delete all the lines referencing anything related to “usb”. Now upload the edited file back to the VM’s folder in the datastore to overwrite the original. Once you unregister the VM and then add it back to the inventory again, you’ll be able to edit the properties of the VM without issue and it will have no references to a USB drive. (You can add one manually if you want to.)

Enjoy,

Steve