Solutions for upload errors.
Common causes: the wrong board or port is selected in Tools > Board / Tools > Port, another program (like Serial Monitor) is holding the port open, or a loose USB connection. Close any open Serial Monitor windows, reselect the correct port, and try again. If it still fails, press the board's reset button right as the upload starts.