I'm using an ESP8266 setup and what I would try is erasing the flash on the ESP8266 and then try to flash it again, followed by a EEPROM reset. Could you try that on the Arduino?
I have experienced the same as you and a EEPROM reset solved it. However, a bad flash to the ESP8266 and the script...