Error uploading a sketch when Serial Monitor is open in another sketch

Hi @Azerla. The Arduino IDE developers are tracking this problematic user experience here:

If you have a GitHub account, you can subscribe to that issue in order to get notifications of any developments.

Arduino IDE 2.x works differently than the classic Arduino IDE in this respect. The classic Arduino IDE actually has the same behavior when you use multiple instances of the IDE.

When you only have a single instance of the classic Arduino IDE running, every window of that instance shares the same board and port setting, meaning you end up switching those settings a lot if you are working with multiple boards at the same time. That is not a problem with Arduino IDE 2.x because every window is a separate instance.