HOW TO DEAL WITH RENDERING ERRORS IN AE
I'm sure every After Effects user had to deal with rendering errors at least one time, and I'm also sure that if it was your first time you were kinda confused, but don't worry now I'll show you my ways of troubleshooting the errors which work in most of the cases.
Checking the status section to find out the moment the error occurs
After a rendering error happens the status section of the render will display the exact moment in the timeline where you'll find the problem, so the first step of troubleshooting will be going on that frame in the timeline.
When you are at the exact time in the timeline you can start looking for the issue: if you switch the preview quality to "full" a black preview should appear and an error message will appear.
Now you have to understand what is provoking the error, you need to search for some keyframe or layer that starts at that exact frame, or also a very high or low value in effects that begins in that frame, switching between a low preview quality and the full one while you disable the layers that don't cause the error will help you understand when the error is triggered.
> Cleaning preview cache
One thing that may help you fix the problem is cleaning the preview cache, After Effects save the already rendered previews, and sometimes it could save some frame that causes an error, or in other cases, your preview cache can be full and you need to clear it.
How can you clear the image cache? The answer is simple: go on the bar at the top and go to ( Edit > Preferences > Media & Disk Cache... ), when the menu appears simply click "Empty Disk Cache..." and "Clean Database & Cache" buttons and confirm.
> Disable GPU accleration
One thing that can cause an error may also be the GPU acceleration, if your GPU driver isn't updated or the GPU itself isn't enough powerful it may cause errors with complex effects. In some cases you have to avoid the use of it in renderings if it keeps crashing, just note that this will impact negatively After Effects performance.
To disable the GPU acceleration you have to go on the bar at the top and go to ( File > Projects Settings... > Video Rendering and Effects ) and switch use to "Mercury software only".
> Common errors
One of the errors I found myself deal the most were errors caused by the motion tile effect or other effects related to expanding and repeating the layer: you go to your layers and check if there are duplicated motion tile effects, that will cause an error however also other effects may cause errors combined with motion tile: certain warp effects, some blur and displacements, and maybe external plugins.
Still related to the motion tile type of errors, the effect you're using (or more effects combined) may exceed the pixel limit AE can calculate and it will cause an error, now this can be only fixed by going through the effects and finding the ones that cause this error, usually searching for the problem in high values or effects that modify a lot the layer "size" (like motion tile, repetile, ...) can help you fix the problem faster.
I also suggest you check if some external effects have settings that allow you to disable the GPU acceleration for them (like sapphire). And the last tip, always check your clips in full size while you edit them so if you do any mistakes you can fix them before starting a render ;).