Stopped being able to Upload to Leonardo

After many successful uploads with a sketch, the upload stopped working after making a minor modification to a sketch. I tried uploading the previous version, that worked, with no success.

On upload, after some time it reports:
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
Found programmer: Id = "�"; type = �
Software Version = i.
Hardware Version = .O
vrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
avrdude: initialization failed, rc=-1
the selected serial port a butterfly/AVR109 but a AVR910 device?
does not exist or your board is not connected
Double check connections and try again, or use -F to override
this check.

The board is a Leonardo.
Arduino 1.8.15 for programming.

The board is functional and the last successful upload is still running fine.
The serial port is functional. The board writes data back to the serial port and the data is correct and continuously updating. The device I am using it on still works fine with all the sensor operational.

On reset the led blinks. I've tried disabling the Bluetooth, reset board, reboot computer, use known good sketch.

What has gone wrong?

Leonardo has a native USB interface. The Leonardo connects to the PC as different USB devices for uploading and for running the sketch.
Probably the automatic resetting of the Leonardo when uploading doesn't work anymore and the IDE doesn't find the bootloader device.
Try to reset it manually when the upload from the IDE starts. It can be a little bit tricky to catch the correct moment. It often helps to press the reset button twice ('double click') because than the bootloader runs a bit longer before starting the sketch.

The code that you upload is composed of your sketch and functionality to detect the reset (open/close serial port at 1200 baud).

Your sketch part probably overwrote some variables that belong to the functionality to detect the reset and that is now broken.

If you enable verbose output during upload in file-> preferences in the IDE, you will see a line stating something like "resetting board" and next a number of lines with the word "port" in them; the latter are the attempts to detect the Leonardo bootloader. Resetting the board while those "port" lines are displayed should do the trick

Thanks for the feedback. That worked!

Thanks for the feedback. I used the method by MicroBahner, but I can see that your method is more reliable as to when to hit the reset. I'll use that next time this occurs. Thanks again.