Hi,
The port list in Tools>Port keeps expanding every time I reset my Leonardo (by using the button), or when I unplug from the USB port and plug it back again.
The port list ends up looking like this:
COM3
COM3
COM5 (Arduino Leonardo)
COM5 (Arduino Leonardo)
COM5 (Arduino Leonardo)
COM8
This in turn prevents me from uploading my sketch (since there are multiple ports present for the same port).
In order to clear the list I have to restart the IDE, which is very annoying.
Is there a way of clearing the list without restarting the IDE?
Or, preventing it to happen in the first place?
-Student
pert
August 1, 2019, 10:32am
2
This is a known bug in the Arduino IDE:
opened 04:15AM - 05 May 19 UTC
closed 08:12AM - 18 Jul 19 UTC
Type: Bug
Type: Regression
Component: Uploading
Component: IDE Serial monitor
Arduino IDE Hourly Build 2019/04/18 12:33 / Arduino IDE 1.9.0-beta build 105, Wi… ndows 10 64 bit
1. Plug the USB cable of a native USB (Leonardo, MKR, Due (Native USB Port)) into your computer.
1. Tools > Serial Monitor
1. Unplug the USB cable.
1. Close Serial Monitor (to avoid https://github.com/arduino/Arduino/issues/8518 when using Arduino IDE 1.9.0-beta).
1. Plug the USB cable of the board into your computer. It doesn't matter whether this is done before or after closing Serial Monitor.
1. Sketch > Upload
The upload process completes successfully, but the Arduino IDE doesn't recognize this and after a delay the upload is shown to have failed with the error:
```
Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload.
```
You must now exit the Arduino IDE and start it again before you can upload without the spurious failure.
When using Arduino IDE 1.8.9 or the Hourly Build, disconnecting the board while Serial Monitor is open and then reconnecting causes multiple duplicate ports to be shown in the **Tools > Port** menu. This does not occur with Arduino IDE 1.9.0-beta, but the spurious upload failure still does occur.

The duplicate ports and spurious upload failure issue does not occur with Arduino IDE 1.8.8.
Originally reported at:
- https://forum.arduino.cc/index.php?topic=613070
- https://forum.arduino.cc/index.php?topic=443558.msg4160634#msg4160634
It is actually two different bugs:
Duplicate ports under the Tools > Port menu.
Spurious upload failure.
They are both triggered by the same event so it's easy to think they are the same bug. The latter error is the serious one. That has already been solved in the hourly build of the Arduino IDE:
The first bug has been fixed in the beta build of the Arduino IDE, but that is purely a cosmetic problem so I recommend you to use the hourly build and ignore the duplicate ports.