An incoming node's name clashes with node already in the scene

Godot Version

4.2

Question

We’re a handful of months into a fairly large game. At this point as our node inheritance structure has grown and we’re starting to run into some relatively painful issues with editing these scenes. For reference our node structure looks existentially as such: Interactable > Agent > Companion > Companion Class > Specific Companion.

If a node is re-parented in Interactable, instances of Specific Companion that are in the game world appear to break. Opening the Specific Companion scene to investigate creates load errors, “An incoming node’s name clashes with (node name) already in the scene (presumably, from a more nested instance).” The scene tree is then populated with duplicates of the nodes listed in the error.

While these errors persist the game somewhat expectedly crashes on load. Fixing it starts as simple as removing the duplicates from the offending node but the problem comes in where we have to go through and delete every instance of the offending node and re-add it to the scene. As you can imagine, this isn’t feasible in the slightest.

Has anyone else encountered issues with multiple levels of inheritance? This is somewhat of a long term deal breaker if we can’t have scenes inherent one another.

I’m not sure I understand your explanation. Instancing a node and duplicate node name issues vs node (class) inheritance? Those concepts seem mutually exclusive.

Because of the load error the scene ends up with duplicated nodes, if that makes more sense. Class inheritance works without issue.

Without knowing the specifics I would guess you have coupling between the nodes that is causing issues.

Children looking for nodes in parents or latterly is a bad idea.

Parents with references to children is okay as long as they know the child is removed/reparented and references are removed and checked before use.

Signals should be employed whenever possible.

Generally speaking there is no know issue for how deep a scene tree becomes. It sounds like you are doing something incorrect when moving nodes dynamically.