Then maybe the default reset method used in the stm32g0x.cfg
is “software reset”, i.e., trying to do a reset by sending a command via SWDIO+SWCLK. Since you use one of those as I/O, that fails. When it instead does a hardware reset via NRST before that, or during that, it’s able to use SWD again.
There are a lot more reset methods available.
A quick thing to try would be to use the config aimed at a Nucleo G0 (st_nucleo_g0.cfg): The config is generic for all G0x boards and uses the reset_config srst_only
method, which may be the one you need.
Just replace
with
"openocd_board": "st_nucleo_g0",
(see platform code).
Otherwise, use your original config, find the stm32g0x.cfg
file in C:\Users\<user>\.platformoi\packages\tool-openocd\
and play around with all possibly reset configs and see which ones work.