Table of contents

The other day I was writing some code for ESP32 in Arduino IDE and when I tried to upload it.. That's the error I got:

usage: esptool [-h]
               [--chip {auto,esp8266,esp32,esp32s2,esp32s3beta2,esp32s3,esp32c3,esp32c6beta,esp32h2beta1,esp32h2beta2,esp32c2}]
               [--port PORT] [--baud BAUD]
               [--before {default_reset,usb_reset,no_reset,no_reset_no_sync}]
               [--after {hard_reset,soft_reset,no_reset,no_reset_stub}]
               [--no-stub] [--trace] [--override-vddsdio [{1.8V,1.9V,OFF}]]
               [--connect-attempts CONNECT_ATTEMPTS]
               {load_ram,dump_mem,read_mem,write_mem,write_flash,run,image_info,make_image,elf2image,read_mac,chip_id,flash_id,read_flash_status,write_flash_status,read_flash,verify_flash,erase_flash,erase_region,merge_bin,get_security_info,version}
               ...
esptool: error: unrecognized arguments: /Users/bartzz/Library/Arduino15/packages/esp32/hardware/esp32/2.0.5/tools/sdk/esp32/bin/bootloader_qio_80m.elf

exit status 2

Compilation error: exit status 2

After reading countless forum posts, reinstalling the ESP32 library and reconnecting my ESP32 back and forth.. Turns out to fix the issue all I needed to do is get rid of the space in the filename.. Yes! Just the space was causing this issue..

arduino ide context menu file save as
File -> Save As...

Then:

arduino ide save as menu
Replace all spaces with "_" then click Save.. 

Now, when you try to click "upload":

arduino ide esp32 code upload output

It works!!!

Happy coding :)