XIAO ESP32C3 Can't erase flash

I have managed to finally erase the flash, but now, when I upload a program, i get an endless stream of:

17:09:00.058 -> invalid header: 0xffffffff

This was the program:

void setup() {
  Serial.begin(115200);
  delay(50);
  Serial.println("starting ..");
  delay(1000);
  // put your setup code here, to run once:
}

void loop() {
  Serial.println("Running");
  delay(3000);
  // put your main code here, to run repeatedly:
}