This usually occurs when a TOC or end note has been 'broken,' either through editing or document corruption.
First, close the doc and InDesign. Start ID, open the doc and IMMEDIATELY try your export (to EPUB, I assume). I don't why it is, but sometimes a fragile doc link will behave if the file has not been edited, autosaved or otherwise 'touched' in a session before trying the export. It is a workaround and doesn't necessarily fix the problem, but it can get you a successful export.
Then try this to clean up your doc: save the file to IDML, then reopen it and save it as a regular INDD file under a new name. That often purges excess junk and fixes structural problems that crop up when a file is edited many times.
Then delete any placed TOC and re-generate it.
If we're down to end notes, the only solution is a tedious process of re-entering each one. Copy the text, delete the end note link, create a new end note, paste in the test, repeat. You might try the export every five or ten notes to see if you've fixed it.
Let us know if none of those fixes work.
| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)