From the error I would guess that you might have a portgroup on the dvSwitch, to which no VMs are connected.
Is that the case ?
I would need some more info on the dvSwitch configuration on which you get this error to do further analysis.
If you could share a screenshot of the dvSwitch layout that would help to get me started.