That's terrible. What kind of footage are you using?
I've witnessed this same error from time to time too. The most obvious is of course to ensure the comp is in fact longer than a frame or two. I'm sure you've checked that.
The fix for me has often been to drop the footage and import it back in but that hasn't worked every time. On a good note, it only seemed to impact ram preview and not the render.
Still seeing this, GuidoPagott? Please let us know.
For persistent causes of this issue, today's bug fix update should solve it.
See the Adobe blog post for more information: A June 2017 Update to After Effects CC Is Now Available | Creative Cloud blog by Adobe
Please let us know if it works for you!