Unable to burn bootloader on MKRZero

Uploading in bootloader mode works sometimes. I can upload the blink sketch and it works. When I upload my own sketch, it does not work. Not even the builtin led. I tried burning the bootloader and got this:

Open On-Chip Debugger 0.9.0-g932ec70 (2017-02-15-12:33)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
Info : only one transport option; autoselect 'swd'
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
Error: unable to find CMSIS-DAP device

Error while burning bootloader.

waveGen.ino (1.43 KB)