So, the quick a dirty solution is:
- Get out of the file in Lyx.
- Open the file in your favorite editor (vi, nano, gedit ... etc.)
- Go to the line with an error.
- Fix or remove whatever seems wrong.
- Save and open the file in Lyx again.
- Compile ... and hope for the best.