I created a new document and copied all my thesis there apart from the \usepakcage{}s. I add all the packages manually and latex would work fine. I then removed all the openning text from the first document including the first paragraph and tried. I got the expected error of now \begin{document}. When I copied the relevant part from the new document I got the same error.
Reduce the problem to a minimal working example (MWE) to make it comprehensible. Perhaps there is an invisible character (or more) in your code. Put all the files together in an archive and attach it to your next post.
I checked the document for bad characters (I sometimes turn my keyboard to cyrilic while falling asleep above the keyboard) and there was none, still this error was there.
It helped me to delete all the files produced during compiling (*.aux, *.log, *.gz, *.toc).
I found the reason why that happened.
You just copy the entire document in Latex to a new document and compile again.
It normally happens when I copy some texts from Microsoft Word to Latex. Maybe Microsoft Word text has some invisible crazy characters.