Port in IDE keep adding up when reset

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

This is a known bug in the Arduino IDE:

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.