I stumbled recently on this error, for me the solution was to just disconnect the arduino from every component it had connected.
Then I selected the port COM4 *this was the only port I had
And checked the bootloader, I had the old bootloader selected, so I switched to Atmega328P and it worked.