Error uploading bootloader, MegaCoreX, SerialUPDI

We are trying to burn a bootloader to a custom ATMega4809 board over serialUPDI. We are following the .ini template provided by MegaCoreX, with adjustments to fit our board specifications

board_build.f_cpu = 4000000L
board_build.variant = 40pin-standard
upload_port = COM3
board_hardware.uart = uart0

Running code

pio run -e fuses_bootloader -t bootloader -v

Produces the error

avrdude: 1 byte of lock verified
avrdude: leaving NVM programming mode
avrdude serialupdi_close() warning: releasing DTR/RTS handshake lines

avrdude done.  Thank you.

avrdude -p atmega4809 -C C:\Users\rn71\.platformio\packages\tool-avrdude\avrdude.conf -P usb -c serialupdi -xrtsdtr=high -U flash:w:C:\Users\rn71\.platformio\packages\framework-arduino-megaavr-megacorex\bootloaders\optiboot\bootloaders\mega0\115200\Optiboot_mega0_UART0_DEF_115200_A7.hex:i
avrdude error: cannot open port usb: The system cannot find the file specified.

avrdude error: unable to open programmer serialupdi on port usb

avrdude done.  Thank you.

*** [bootloader] Error 1
================================================= [FAILED] Took 3.65 seconds ===========================================

Upload_UPDI       IGNORED
Upload_UART       IGNORED
fuses_bootloader  FAILED    00:00:03.647
============================================ 1 failed, 0 succeeded in 00:00:03.647 ============================================

Does anyone know what we may be doing wrong? Thanks in advance!

I 've been running into this problem too, working on ATmega4808 though.
I have tried this:
but did not work (same error).
Perhaps this issue relates to this:

It looks like some python script in the guts of platformio is missing some information.
I am just wondering… the issue was closed more than 3 years ago.

Hello! I opened the issue with MCUdude: He found and fixed the root cause

To fix the problem, I just needed to replace my local copy of the script (for me, at location: "~\.platformio\platforms\atmelmegaavr\builder\") with the updated version here:

Hope this solves your problems, too!