Error during Upload: Compiled sketch not found

Hello all, I'm trying to compile and upload my sketch using the following commands:
arduino-cli compile --build-path $PWD/ArduinoOutput -b esp8266:esp8266:generic sketch
and then
arduino-cli upload -p port -b esp8266:esp8266:generic sketch

It used to work just fine, but now I'm having an upload error:
Error during Upload: Compiled sketch not found in /private/var/folders/gg/...

Working on Mac OS 11.6

From https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_compile/#options

--build-path string Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS.

With this flag, you can instructing the compile command to put the compiled binaries in a custom location. The arduino-cli upload command doesn't know anything about that custom location unless you tell it about it. So if you use a custom build path in your compile command, then you must also use a custom input directory in your upload command:
https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_upload/#options

--input-dir string Directory containing binaries to upload.

So the correct upload command would be:

arduino-cli upload -p port -b esp8266:esp8266:generic --input-dir "$PWD/ArduinoOutput"
1 Like

I always thought it was a bit strange not specifying anything in the upload command, but never could find what to do about it. Thank you so much!

You're welcome.