Nearly Identical Code...Only One Works

I have been attempting to flash an ESP8266 EP-01 with the example code Blink:

/*
  ESP8266 Blink by Simon Peter
  Blink the blue LED on the ESP-01 module
  This example code is in the public domain

  The blue LED on the ESP-01 module is connected to GPIO1
  (which is also the TXD pin; so we cannot use Serial.print() at the same time)

  Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
  // but actually the LED is on; this is because
  // it is active low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}

However, I keep getting a timed out packet header error:

Executable segment sizes:


IROM   : 227612          - code in flash         (default or ICACHE_FLASH_ATTR) 


IRAM   : 26776   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 


DATA   : 1252  )         - initialized variables (global, static) in RAM/HEAP 


RODATA : 672   ) / 81920 - constants             (global, static) in RAM/HEAP 


BSS    : 24880 )         - zeroed variables      (global, static) in RAM/HEAP 


Sketch uses 256312 bytes (26%) of program storage space. Maximum is 958448 bytes.
Global variables use 26804 bytes (32%) of dynamic memory, leaving 55116 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port COM12
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
  File "C:\Users\jeffr\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.6.3/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "C:/Users/jeffr/Documents/ArduinoData/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 2890, in main
    esp.connect(args.before)
  File "C:/Users/jeffr/Documents/ArduinoData/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 483, in connect
    raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

However, the code below:

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

flashes the WiFi chip in less than 30 seconds. Any clue why that is?

No idea, but i saw only 2 differences, HIGh, LOW are reversed and the delaytime, how about you alter those in the second to the way it is in the first sketch, one change at a time and see and see what happens, maybe it doesn't have something with the sketch, but rather with the esptool, or with the core, i was getting those kind of errors when i upgraded to 2.6 (from 2.4.2) so i rolled back, had a similar though different experience with 2.5.x Since there seemed no consistence in the error, and the older version had no issues that i could find (apparently there is a memory leak, but my code doesn't trigger it as far as i know. )