Another possibility are wrong / divergent settings for transfer rates. I’ve made the experience that is a good practice to fix transmission rate in platformio.ini
[env:d1_mini]
platform = espressif8266
board = d1_mini
test_speed=460800
test_port=/dev/ttyUSB0
as well as in your code
void setup() {
Serial.begin(460800);
}
If I alter the value for test_speed to a value other than that used in code I observe the same phenomenon like you