Atmega328pb bootloader problem

I have a run of 10 PCBs using atmega328pb.
Using VS Code and PIO I successfully flashed optiboot.
7 of the 10 boards also flashed OK via plain USB via the bootloader.
3 of the 10 fail flashing via USB.

Replacing the 340G on one of the PCBs fixed the issue but I doubt the problem is really the 340G.

The fails look like this:
Uploading .pio\build\USB_328PB\firmware.hex
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9516 (probably m328pb)
avrdude: processing -U flash:w:.pio\build\USB_328PB\firmware.hex:i
avrdude: reading input file .pio\build\USB_328PB\firmware.hex for flash
with 24490 bytes in 1 section within [0, 0x5fa9]
using 192 pages and 86 pad bytes
avrdude: writing 24490 bytes flash …
Writing | #####################----------------------------- | 42% 3.69s
avrdude error: unable to write: sorry no info avail
avrdude error: programmer is not responding
avrdude: 24490 bytes of flash written
avrdude: verifying flash memory against .pio\build\USB_328PB\firmware.hex
Reading | ################################################## | 100% .77s
avrdude warning: verification mismatch
device 0xff != input 0x08 at addr 0x2900 (error)
avrdude error: verification mismatch
avrdude done. Thank you.

My INI:
[env:BOOTLOADER_328PB]
platform = atmelavr
board = ATmega328PB
framework = arduino
board_build.f_cpu = 16000000L
board_bootloader.file = optiboot_atmega328pb.hex
board_bootloader.type = optiboot
board_bootloader.speed = 38400
board_hardware.uart = uart0
upload_protocol = usbasp
upload_flags = -PUSB -B8

[env:USB_328PB]
platform = atmelavr
board = ATmega328PB
framework = arduino
upload_protocol = arduino
upload_port = COM3
upload_speed = 38400
lib_deps = olikraus/U8g2@^2.35.15

Trying URBOOT gives this:
Linking .pio\build\USB_328PB\firmware.elf
Checking size .pio\build\USB_328PB\firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [==== ] 44.8% (used 917 bytes from 2048 bytes)
Flash: [======== ] 75.9% (used 24490 bytes from 32256 bytes)
Building .pio\build\USB_328PB\firmware.hex
Configuring upload protocol…
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port…
Using manually specified: COM3
Uploading .pio\build\USB_328PB\firmware.hex
avrdude warning: attempt 1 of 10: not in sync: resp=0xa0
avrdude error: programmer is not responding
avrdude warning: attempt 2 of 10: not in sync: resp=0x00
avrdude error: programmer is not responding
avrdude warning: attempt 3 of 10: not in sync: resp=0x00

Any help would be appreciated.