This is usually caused by a corrupted/incomplete
.toc or other intermediate file, and is frequently a sign that your project is running into its compile timeout limit. You can first try to clear the intermediate files by clicking on the "Recompile from scratch" option at the bottom of the error message window.
If you then get a
compile timeout error, see this help article for some suggestions.