Error while uploading

Sketch uses 265292 bytes (53%) of program storage space. Maximum is 499696 bytes.
Global variables use 26912 bytes (32%) of dynamic memory, leaving 55008 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
Failed uploading: uploading error: exit status 2

reinstalled my drivers
tried reseting the esp
downgraded my board version
tried changing COM ports
checked the wiring still the error persists
heres my code

#include <ESP8266WiFi.h>

const char *ssid = "MyESP8266_AP";    // Access Point Name (SSID)
const char *password = "123456789";   // Access Point Password

void setup() {
  // Start the Serial communication
  Serial.begin(115200);

  // Set up the ESP8266 as an Access Point
  WiFi.softAP(ssid, password);

  // Get the IP address of the Access Point
  IPAddress IP = WiFi.softAPIP();
  // Print the IP address to the serial monitor
  Serial.println("Access Point Started!");
  Serial.print("IP Address: ");
  Serial.println(IP);
}

void loop() {
  // Nothing to do in loop
}

Hi @deskwifi. Please tell us which board you have.

Do you have the Arduino Nano ESP32 board?

Or do you instead have some other 3rd party board.

We are happy to help solve problems with any board, but we need to know more about your hardware in order to effectively assist you.

Hello, I am using an Arduino Nano connected to an ESP8266 chip.

I moved your topic to a more appropriate forum category @deskwifi .

The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.

In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.

Thanks in advance for your cooperation.