In my case, the error occurred when I modified a file (.Build.cs) in the project. Once I removed my added line, everything started compiling fine.