PlatformIO sometimes connects to the port, sometimes it doesn't

Hello !

I noticed a strange behavior today with an ESP32 Wroover DevKitV4. The ESP is connected to a 5V power supply and also to the PC using an USB cable via a USB powered hub.

That should mean that I don’t have to press the BOOT button to be able to upload code or data to the ESP.

Buuut, right now the IDE uploads only 50% of the time, while the other half ends in this:

Serial port /dev/ttyUSB0

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
*** [uploadfs] Error 2

I’ve tried keeping the BOOT button pressed but to no avail.
It simply will not connect to the ESP. But on the second try will connect almost immediately and work.

Soooo, what is happening ?