On my Mac Pro (model 6,1 - the 2013 Trashcan) suddenly WiFi stopped working.
I couldn't even enable it anymore and looking in the System Preferences - Network, selecting the WiFI triggered an error.
This may happen on other models and other macOS versions as well.
It took me some time and effort to find the fix, but this worked for me:
We need to remove a few files from this directory:
/Library/Preferences/SystemConfiguration/
It affects these files (not all may be available on your Mac):
NetworkInterfaces-pre-upgrade-new-target.plist
NetworkInterfaces-pre-upgrade-source.plist
NetworkInterfaces.plist
com.apple.airport.preferences.plist
com.apple.airport.preferences.plist.backup
com.apple.network.eapolclient.configuration.plist
com.apple.wifi.message-tracer.plist
preferences-pre-upgrade-new-target.plist
preferences-pre-upgrade-source.plist
preferences.plist
preferences.plist.old
I copied them to a backup folder on my desktop, and then deleted them from the original location.
After that reboot your Mac.
In my case, WiFi worked and right away detected and connected to my WiFi network.
This may not work for everybody, but it worked for me.