# How to recover from error in this situation

Well, I just encountered a very weird situation.

I had a working tex document(no problem with compiling). Then I changed one symbol somewhere in the document. When I compiled the changed document, it gave me undefined control sequence error, which is totally fine.

The problem is, when I changed the symbol back to what it originally was and tried to compile the recovered document, it gave me the following error:

Runaway argument?
{49
! File ended while scanning use of \BKM@entry.
<inserted text>
\par
l.33 \begin{document}

?


Could someone please show me possible reasons?

Edit: Since the document is a chapter of my paper, I tried deleting the document and excluding it from the paper. To my surprise, I ended up with the same compile error as if the document was not deleted at all. So I suspected that the compiler was working on some pre-compiled files(I only deleted the tex document but not the corresponding aux file). Then I tried deleting all aux files, everything compiles like charm. However, I still don't understand what's wrong in the first place.

-
A M(N)WE is required, as usual... –  karlkoeller Aug 30 at 17:20
What was this one symbol you changed? Did you forget a bracket some where? –  dustin Aug 30 at 17:21
TeX does not allow a \par in the argument of a macro (unless you specifically allow it), and this is the error you get when it finds one. As suggested you are (almost certainly) missing a closing } somewhere, so TeX has gone on reading a macro argument until it hit a blank line or an explicit \par. From the look of the error it appears that it's missing just after the string "{49". You might like to read pp205-206 of the TeX Book on the subject of runaways. –  Thruston Aug 30 at 17:29
@dustin Yes, everything is back to where it was. The only logic I can think of to explain this weirdness is, when I compiled the changed document, the undefined control sequence error polluted the aux file for that document. When I changed the document back to where it was, I kept getting the same runaway argument error even if I deleted the tex file. So I assume the compiler must have been working on the polluted aux file rather than the normal tex file. This is just my reasoning based on observations. –  Terry Li Aug 30 at 18:34
@TerryLi -- your logic is exactly correct. .aux files, and sometimes other "derived" files (i've seen it happen with .idx/.ind files) get written out with bad or incompatible code. some reasons are given in these (and other) questions: Delete .aux file in order to successfully compile, newclude has destroyed my application –  barbara beeton Aug 30 at 19:27