It sounds like perhaps you might have something before that code that is interfering - have you checked that every line ends with a double space or a period after quotes?
You might also try creating a new project file, then copying and pasting your code in section by section and compiling after each to see where it errors out.
Alternately: comment out your code volume by volume, then book by book, and so on until you’ve isolated the error. It’s a pain but it will give you the actual location of the problem.