Hi @JohnRob . There are a couple of known bugs that would cause this to happen if you had Serial Monitor open in a previous IDE window:
opened 02:16PM - 31 Oct 21 UTC
closed 05:55AM - 08 Jun 22 UTC
topic: documentation
conclusion: resolved
topic: code
type: imperfection
topic: serial monitor
criticality: medium
## Describe the bug
It is not uncommon for a user to have multiple windows op… en with the same port selected in each. If the Serial Monitor is open in one of those windows, uploads from the other window will fail.
## To Reproduce
1. Connect any Arduino board to your computer.
1. Select the board and port in the Arduino IDE menus.
1. Open Serial Monitor (e.g., **Tools > Serial Monitor**).
1. Select **File > New** from the Arduino IDE menus.
1. Select **Sketch > Upload** from the Arduino IDE menus.
🙁 Note that the upload has failed with an error something like "`avrdude: ser_open(): can't open device "\\.\COM7": Access is denied.`"
## Expected behavior
Handle sharing port usage between windows automagically.
**OR**
More effectively communicate the cause of the upload failure and the required action to the user.
**OR**
Clearly document the cause of the upload failure and the required action (https://github.com/arduino/arduino-ide/issues/271).
I would recommend taking the approach of *"so you have x problem, here is the solution ..."* rather than *"here is how to upload/use Serial Monitor properly ..."*. The reason is that the user is much more likely to go searching for a specific solution once they have the problem than to proactively study the documentation in advance of doing an upload.
With this approach, the appropriate location for the documentation would be [the Help Center](https://support.arduino.cc/hc/en-us/sections/360003198300). The [classic Arduino IDE points the user there](https://github.com/arduino/Arduino/blob/1.8.16/arduino-core/src/cc/arduino/packages/Uploader.java#L179) in the event of a failed upload.
The article should be titled with the unique components of the various common error messages that occur when attempting to upload to an open port. It should also take into account that there are multiple possible causes of this error.
## Desktop
- OS: Windows 10
- Version: 2.0.0-beta.12-nightly.20211028
Date: 2021-10-28T03:03:25.353Z
CLI Version: 0.19.1 alpha [718bbbf2]
## Additional context
Originally reported at https://github.com/arduino/arduino-ide/issues/271#issue-840803269
### Comparison to classic Arduino IDE
This is not usually a problem in the classic Arduino IDE because all windows share the same Serial Monitor and are able to juggle the control of the port between the upload process and Serial Monitor automagically.
The exception is when the user has opened multiple instances of the Arduino IDE, in which case it behaves the same as Arduino IDE 2.x in that each instance has its own Serial Monitor and can not control the Serial Monitor of the other instance. However, this multiple instance usage is not very common, and more often employed by advanced users who are easily able to identify the cause of the upload failure that results from these conditions.
opened 04:15PM - 28 Dec 21 UTC
closed 05:31PM - 08 Jun 22 UTC
conclusion: resolved
topic: code
type: imperfection
topic: serial monitor
## Describe the bug
The Arduino IDE uses the serial ports of Arduino boards i… n two different ways:
- Uploading sketches
- Communication via Serial Monitor
The port can not be used for both of these things simultaneously. The IDE handles the condition of Serial Monitor being open when an upload is started automagically like so:
1. Close port in Serial Monitor
1. Complete upload process
1. Reopen port in Serial Monitor
:bug: This works as expected in the first IDE window you open, but it no longer works in subsequent windows.
***NOTE***: although similar, this is different from https://github.com/arduino/arduino-ide/issues/586 because it occurs even when the port is not open in a Serial Monitor/Serial Plotter of another IDE window.
## To Reproduce
1. Connect an Arduino board to your computer.
1. Select the appropriate board and port.
1. Select **Tools > Serial Monitor** from the Arduino IDE menus to open Serial Monitor.
1. Select **Sketch > Upload** from the Arduino IDE menus.
:slightly_smiling_face: Upload succeeds as expected.
1. Select **Tools > Serial Monitor** from the Arduino IDE menus to close Serial Monitor.
This is necessary to avoid https://github.com/arduino/arduino-ide/issues/586
1. Select **File > New** from the Arduino IDE menus.
1. Select **Tools > Serial Monitor** from the Arduino IDE menus in the new window.
:bug: Note that there is an unexpected banner in Serial Monitor:
> Not connected. Select a board and a port to connect automatically.
1. Select **Sketch > Upload** from the Arduino IDE menus.
:bug: Upload fails with an error something like "avrdude: ser_open(): can't open device "\\.\COM7": Access is denied."
## Expected behavior
Upload with Serial Monitor open in the same IDE window to always be handled automagically.
## Desktop
- OS: Windows 10
- Version: 2.0.0-rc3
Date: 2021-12-22T15:46:56.004Z
CLI Version: 0.20.2 [13783819]
## Additional context
It is not necessary to leave the original window open to reproduce the bug. It occurs even if that window is closed.
---
I bisected the issue to https://github.com/arduino/arduino-ide/commit/767b09d2f10cab78b07754039ebb749d55b45d8d (it does not occur at https://github.com/arduino/arduino-ide/commit/88397931c5b704516e881959f6e7ce106094d14d).
---
Originally reported at https://forum.arduino.cc/t/upload-failed-when-serial-monitor-is-open/940255
The only upload problem I'm aware of that would occur if you only ever had Serial Monitor open in a single IDE window during the session is timing specific:
opened 11:10AM - 28 Oct 21 UTC
closed 01:57AM - 03 Aug 22 UTC
conclusion: resolved
topic: code
type: imperfection
topic: serial monitor
### Describe the problem
The Arduino IDE uses the serial ports of Arduino boa… rds in two different ways:
- Uploading sketches
- Communication via **Serial Monitor**
The port can not be used for both of these things simultaneously. The IDE handles the condition of **Serial Monitor** being open when an upload is started automagically like so:
1. Close port in **Serial Monitor**
2. Complete upload process
3. Reopen port in **Serial Monitor**
🐛 It does not currently handle the reverse, where the **Serial Monitor** is opened while an upload is in progress. This results in a confusing upload failure.
### To reproduce
1. Close **Serial Monitor** if it is already open.
1. Start an upload to an Arduino board.
NOTE: because it is timing sensitive, the issue will be difficult to reproduce with a minimal sketch that compiles very quickly, especially on a subsequent compilation when the libraries have already been cached. Use a larger sketch to accurately simulate real world conditions.
1. While the compilation process that occurs before the actual upload starts is still in progress, select **Tools > Serial Monitor** from the Arduino IDE windows.
The board's port is now opened in **Serial Monitor**.
1. Wait for the upload process to finish.
🐛 Note that the upload has failed with an error something like:
```text
avrdude: ser_open(): can't open device "\\.\COM7": Access is denied.
```
### Expected behavior
Don't allow user to break upload by opening **Serial Monitor**.
Arduino IDE 1.x allows **Serial Monitor** to be opened during upload, but it is in a disabled state where the opening of the port is deferred until after the upload finishes, behaving just the same as when an upload is started with **Serial Monitor** already open:

### Arduino IDE version
2.0.0-beta.12-nightly.20211028
### Operating system
Windows
### Operating system version
10
### Additional context
Originally reported at https://github.com/arduino/arduino-ide/issues/271#issuecomment-812899242
### Issue checklist
- [X] I searched for previous reports in [the issue tracker](https://github.com/arduino/arduino-ide/issues?q=)
- [X] I verified the problem still occurs when using the latest [nightly build](https://github.com/arduino/arduino-ide#nightly-builds)
- [X] My report contains all necessary details
If you are able to determine that the problem you had is not one of these known bugs, please let us know here on the forum or via an issue report on GitHub if you prefer.