STM32L Nucleo OpenOCD error on second pass

Usually this indicates a problem with the used reset method (software / hardware).

Could you please try the following: Build the project normally once, then open a CLI and execute the command

C:\Users\goran\.platformio\packages\tool-openocd\bin\openocd -d2 -s C:\Users\goran\.platformio\packages\tool-openocd\scripts -f interface/stlink.cfg -c "transport select hla_swd" -f target/stm32l0.cfg -c "reset_config srst_only" -c "program {.pio\build\nucleo_l053r8\firmware.elf} verify reset; shutdown;"

aka the same command as above but with -c "reset_config srst_only" to use a different reset method.

You may also try different values from here.

Once one works it can be put in the platformio.ini with e.g.

upload_flags =
    -c
    reset_config srst_only

Edit: corrected -c "set reset_config srst_only" to -c "reset_config srst_only" to which should be right