Assuming you have a locally installed CUDA toolkit you could debug the code via:
cuda-gdb --args python script.py args
...
run
...
bt

where bt would show the backtrace of and should point to the failure.
While cuda-gdb won’t block the kernel launches, note that it’s also slowing down the execution.