I had this same issue, but I managed to find and fix it.
From what i can tell, it happens when the name of the script(i.e. "PlayerMovement.cs"), doesn't match the "class name" (i.e. "public class Player : Node").
Just replace the "class name" with the file name.
(I.E. "public class PlayerMovement : Node").
Hope this helps.