AVRDUDE issues when started from platformio


My board has an ATMega644PA and I try to program it via a Diamex (AVRISP MKII compatible programmer.

My platformio.ini is like this:

However when I try to program I get this error:

Programming via AVRdudess is working without issues (seperate installed AVRdudess).
It uses the following command line:
C:\Program Files (x86)\AVRDUDESS>avrdude -c avrisp2 -p m644pa -P usb -v -U flash:w:"C:\Users\BProsman\OneDrive\Kicad_Projects\Eurocard Eprom Emulator\Eprom Emulator Eurocard FIRMWARE\Eurocard Eprom Emulator FIRMWARE\.pio\build\program_via_AJP-DIAMEX_AVRISP_mkII\firmware.hex"