Port in IDE keep adding up when reset


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:

COM5 (Arduino Leonardo)
COM5 (Arduino Leonardo)
COM5 (Arduino Leonardo)

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?


This is a known bug with Arduino IDE 1.8.9 and newer:

It only occurs when you have Serial Monitor open so you could avoid it by closing Serial Monitor before you reset or unplug your board.

The other workaround is to use Arduino IDE 1.8.8 until a new release of the Arduino IDE comes out with the bug fixed. You can download Arduino IDE 1.8.8 here:

It is also a known issue with other versions of the IDE too.

More often it has to do with Windows 7-10 inc Vista.
Not heard of it on Linux or Macs.

Most often it tends to eventually settle unless you have a lot of differing Arduinos at which point it can become an occasional pain requiring a COM stack reset (which is quite simple luckily).

COM numbers over 30 can cause additional issues within windows again needing the COM stack to be reset.

WARNING do not try to lock the COM port as that too can lead to other issues when trying to use Arduino's


Thank you guys!