Node being returned as incorrect type / error constructing instance

Godot Version

4.2.1stable

Question

I have a PC (player character) scene with many children, including a child node Feats (a default Node, purely for organizational purposes) and its child node Ancestry1 of type FeatSlot.

I have another scene, CharacterCreator, which I’m currently working on. When I instantiate the PC scene, everything works great. When I grab the PC’s children, everything works great. Then all of a sudden, when I get this specific node via PC.get_node(“Feats/Ancestry1”), Godot decides to return an object of type Node instead of type FeatSlot. I can’t assign the node to a variable of type FeatSlot, and I can’t access any of the properties unique to the FeatSlot type.

I’ve tried to include as much detail as possible in the below image. You can see the code that’s running in the center, the node and its type in the scene tree, the error report in the Debugger, and the node in question “f” in the inspector. As you can see, the inspector doesn’t acknowledge the node having any types other than Node, even though the scene tree clearly shows it having the FeatSlot type.

The relevant error in the debugger is “_create_instance: error constructing a GDscript instance”. This error also appears when I run the PC scene on its own, so there’s something in that scene causing problems. But no other errors point to a specific spot in the scene/code. What could cause this?

EDIT: I’ve also noted the error points to line 188 in modules/gdscript/gdscript.cpp, which you can view here. I can’t tell what’s going on there enough for it to be helpful to me, but maybe someone else can make sense of it.

Can you show the Ancestry1 script?

I think I found the problem while going to show the script. The FeatSlot type has an _init with required parameters, and I just looked it up and found that you can’t instance a node in the scene tree if _init has such. I had assumed I could define the variables either in _init or in the inspector, not that I had to pick beforehand.