I have this problem regularly with my MKR boards, never my Uno and other AVR boards yet. It has something to do with trying to upload with the Serial Monitor open (which should be fine). I've found that I can fix it by exiting all Arduino IDE windows, unplugging the board, then starting the Arduino IDE again. I don't know if the same will fix your issue with the Uno.