You could run the script via compute-sanitizer or cuda-gdb to get the stacktrace or alternatively you could also create a cuda coredump via CUDA_ENABLE_COREDUMP_ON_EXCEPTION=1 and check it via cuda-gdb afterwards.
If this doesn’t work, could you post an executable code snippet to reproduce the issue?