I guess I know why it happens. I just faced the same issue and by reading it carefully, I figured what is wrong.
I had this pair of .h and .cpp files inside my source directory:
Source/SomeProject/Some/Path{1}/SomeActor.cpp
Source/SomeProject/Some/Path{1}/SomeActor.h
Then, I added the following for keeping the enums related to that actor in a separate header file (notice Path2):
Source/SomeProject/Some/Path{2}/SomeActor.h
It gave me the same error as you. I renamed the file to:
Source/SomeProject/Some/Path{2}/SomeActorTypes.h
And, viola it’s solved. I did not even need to regenerate the project files.