An illegal memory access error in CUDA occurs when a kernel attempts to access memory that it is not allowed to access.