I keep bumping into this issue as well. What seems to work for me is to make sure that the type of the public variable is the type you intend to use. Then redo your drag and drop in the inspector. Finally, make sure your Instantiate() is being assigned to that same type.
Don’t have a public GameObject or Transform that you drag your prefab to in the editor, and then try to instantiate it as the class name of your prefab and/or assign it to something that is the type of your prefab.