I too; have had this and still do; but mainly on large projects, it is frustrating and annoying.
I have not been able to pin point the cause; but is more prone when I have lots of nested {$ifdef}, that have the defines in the project options/custom defines section. If I add the defines as source code in the all units ir {$define xxx} then the errors are a lot less more unlikely to happen.
This started in 1.8 and is still in svn, as I have not been able to produce a sample project that exhibits the behaviour, unfortuanetly I cannot upload the projects that may exhibit this behavious for various reasons.
When it starts to happen, I find that doing a re-scan of sources will help for a while, but what does last much longer is exit lazarus; restart lazarus and rebuild lazarus. This seems to help but not eleminate it, as it will come back.
I have noticed that just prior to it doing this, I also get one or both of the following happening.
1)Clicking an existing components event; produces an error along the longs of tform not found, and does not locate you the event code.
2)The autocomplete of code stops working. ie typing "form1." does not bring up a list of proc/funcs. record variables does not bring up popup of variables. ie "my3dobj." will not bring up variables of record like, x,y,z,s etc that are defined in its record.
It is worth noting that it does not matter if you compile you project during your lazarus session as it can happen before you have even compiled your project for the first time in the session.
Hopefully some of the observations I have found will be useful.