Esp8266 D1 mini Invalid Head of packet during uploading

I don’t what happen but all of a sudden I started receiving this error when trying to upload codes to the D1 mini

Heres the code I’m trying to upload

#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <WiFiClientSecure.h>
#include "certs.h"
#include <LEDStripDriver.h>

// DIN=GPIO16, CIN=GPIO14
LEDStripDriver led = LEDStripDriver(16, 14);
char messageBuffer[50];

WiFiClient espClient;
PubSubClient client(espClient);

unsigned long currentTime;
unsigned long startTime;

String lastledcolor;
String ledcolor;
int command;
void setup_wifi()
{
  Serial.print("connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    Serial.print(".");
    pause(500);
  }
  Serial.println();
  Serial.print("WiFi connected to ");
  Serial.println(ssid);
  Serial.print("IP address : ");
  Serial.println(WiFi.localIP());
  pause(2000);
}

void setup() {
  Serial.begin(9600);
  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
  led.setColor(0, 0, 0);
}

void loop()
{
  if (!client.connected())
  {
    reconnect();
  }
  client.loop();
  if (command == 1)
  {
    Rainbow();
  }
  else if (command == 0)
  {
    lastledcolor = ledcolor;
    stopRainbow();
  }
}

void reconnect()
{
  while (!client.connected())
  {
    if (client.connect("Reception"))
    {
      Serial.println("connected");
      client.subscribe("RGB/Output");
    }
    else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again");
    }
  }
}

void callback(char* topic, byte* payload, unsigned int length)
{
  //Serial.println();
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  Serial.print("length : ");
  Serial.println(length);
  memcpy(messageBuffer, payload, length);
  messageBuffer[length] = '\0';
  Serial.print("the payload is : ");
  Serial.println(messageBuffer);
  if (strcmp(messageBuffer, "change") == 0)
  {
    Serial.println(strcmp(messageBuffer, "change"));
    command= 1;

  }
  else if (strcmp(messageBuffer, "freeze") == 0)
  {
    Serial.println(strcmp(messageBuffer, "freeze"));
    command= 0;

  }
}

void stopRainbow()
{
  if (lastledcolor == "red")
    led.setColor(255, 0, 0);
  else if (lastledcolor == "green")
    led.setColor(0, 255, 0);
  else if (lastledcolor == "blue")
    led.setColor(0, 0, 255);
  else if (lastledcolor == "yellow")
    led.setColor(255, 255, 0);
  else if (lastledcolor == "cyan")
    led.setColor(0, 255, 255);
  else if (lastledcolor == "magenta")
    led.setColor(139, 0, 139);
  else if (lastledcolor == "orange")
    led.setColor(255, 69, 0);
  else if (lastledcolor == "pink")
    led.setColor(255, 20, 147);
}

void Rainbow()
{
  ledcolor = "red";
  led.setColor(255, 0, 0);
  pause(1000);
  ledcolor = "green";
  led.setColor(0, 255, 0);
  pause(1000);
  ledcolor = "blue";
  led.setColor(0, 0, 255);
  pause(1000);
  ledcolor = "yellow";
  led.setColor(255, 255, 0);
  pause(1000);
  ledcolor = "cyan";
  led.setColor(0, 255, 255);
  pause(1000);
  ledcolor = "magenta";
  led.setColor(139, 0, 139);
  pause(1000);
  ledcolor = "orange";
  led.setColor(255, 69, 0);
  pause(1000);
  ledcolor = "pink";
  led.setColor(255, 20, 147);
  pause(1000);
}

void pause(unsigned long period)
{
  currentTime = millis();
  if (currentTime - startTime >= period)
  {} startTime = currentTime;
}

What is the error? Copy & paste it in using code tags like you did for the code.

CrossRoads:
What is the error? Copy & paste it in using code tags like you did for the code.

Nvm mind its weird. All I did was leave it alone for a while and it works now