# CUDA error: device-side assert triggered when generating many audio files in a row
Generating lots of TTS segments in a loop, e.g. chapters of a book, intermittently crashed with `CUDA error: device-side assert triggered` on around 10% of prompts. A community member diagnosed it: each generation has a small chance of producing invalid tokens, and many generations in a row make the crash likely. Their fork, better-chatterbox on the fix-cuda-issue branch, strips the invalid tokens, and multiple users confirmed it fixed the crashes, with one reporting a full day of book generation without a single failure.
## How to handle it
The device-side assert is not a VRAM problem: it comes from occasional invalid tokens in the generated sequence, and looping over many segments just gives it more chances to appear. The community-verified fix is the better-chatterbox fork on its fix-cuda-issue branch, which removes the bad tokens before they hit the CUDA kernel. Install it as a drop-in replacement for chatterbox-tts and the intermittent crashes stop. Several users confirmed hours of generation with no failures after switching.
Source: https://github.com/resemble-ai/chatterbox/issues/72