Not sure why this happens. Generally, it occurs after I'm idle, i.e. going to grab a cup of coffee or getting lunch. The only way I've been able to solve this so far is by restarting the program, which is annoying.
I run the software and media cache of my OS SSD (Samsung 860 PRO 256GB), files are stored on my external SSD (Vectotech 256GB SSD), the processor is an i7 6700K, 16GB of DDR4 2133mhz ram, and the GPU is an MSI Armor GTX 1070. So my system is beefy enough to handle After Effects, could be better but does the job.