Invalidating the cache did not work for me. However in the file menu , there is an option named "Repair IDE". I clicked on this and went through the steps until it self repaired and started working correctly.
I am using version 2024.3.3