Can't upload to my board while serial monitor is open

Not so. When using most boards, Arduino IDE automatically closes the port in Serial Monitor before starting the upload process, only reopening the port in Serial Monitor after the completion of the upload. So Serial Monitor is specifically designed in order to avoid it interfering with uploads.

As @van_der_decken pointed out, unfortunately there is a bug in that port juggling system which can cause the Serial Monitor to interfere with uploads. However, as far as I know, that bug is specific to the boards that have an FTDI FT232R USB chip. It is not known to occur with boards that have any other USB chip.

In @bakedpotatolord2's comment on GitHub, they said they are using an "Arduino uno". The official UNO series of boards use an ATmega16U2 instead of an FT232R FTDI chip, so the bug does not affect them. The common clone/derivative boards either use the ATmega16U2 or WCH CH340, so also are not affected. So I am doubtful the upload error they are experiencing is caused by that bug. However, it is possible.

However, we have received some reports of uploads failing with this error with cheap derivative boards that have strange unlabeled USB chips which are definitely not genuine FTDI chips, but identify as FT232R:


@bakedpotatolord2 Please tell us which USB to serial bridge chip your Arduino board has. This is a black chip near the USB socket.

The chip will usually be identified by writing on the top. This might say something like "Atmel MEGA16U2" or "WCH CH340G" or "SILABS CP2102".

Examples:

Microchip ATmega16U2

📷

MakeMagazinDE - CC BY-SA 4.0 (cropped)

FTDI FT232R

📷

ICIC-SS28-X-K232-01 by oomlout - CC BY-SA 2.0 (cropped)

WCH CH340

📷

SparkFun - CC BY-SA 4.0 (cropped)

There are some boards on the market that have a USB chip with the same IC package as the WCH CH340, and which are identified by the computer as a CH340. However, these chips don't have the "WCH CH340C ..." labeling like you see on the chip in the picture above:

📷

NodeMCU Lua Lol1n V3.jpg by Popolon - CC BY-SA 4.0 (cropped)

These mysterious unlabeled chips have different characteristics than the labeled CH340 chips, so please let us know if yours is labeled or not.


If it isn't clear, alternatively you can provide the link to where you bought the board from and we'll see if we can determine the chip from the product listing.