Error: Parameter "common_parent" is null.

Godot Version

v4.1.1.stable.mono.official [bd6af8e0e]

Question

Hello everyone. I have an error in my code that doesn’t seem to affect the game in any way, but I would still like to deal with it. Here is the complete error:

E 0:00:04:0643 Godot.NativeInterop.NativeFuncs.generated.cs:345 @ void Godot.NativeInterop.NativeFuncs.godotsharp_method_bind_ptrcall(IntPtr , IntPtr , System.Void** , System.Void* ): Parameter “common_parent” is null.
<Исходный код C++>scene/main/node.cpp:1988 @ get_path_to()
<Трассировка стека>Godot.NativeInterop.NativeFuncs.generated.cs:345 @ void Godot.NativeInterop.NativeFuncs.godotsharp_method_bind_ptrcall(IntPtr , IntPtr , System.Void** , System.Void* )
NativeCalls.cs:3490 @ Godot.GodotObject Godot.NativeCalls.godot_icall_1_377(IntPtr , IntPtr , Int32 )
Node.cs:1518 @ Godot.Node Godot.Node.Duplicate(Int32 )
sample.cs:89 @ void sample.body_entered(Godot.Node3D )
sample_ScriptMethods.generated.cs:41 @ Boolean sample.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.NativeVariantPtrArgs , Godot.NativeInterop.godot_variant& )
CSharpInstanceBridge.cs:24 @ Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(IntPtr , Godot.NativeInterop.godot_string_name* , Godot.NativeInterop.godot_variant** , Int32 , Godot.NativeInterop.godot_variant_call_error* , Godot.NativeInterop.godot_variant* )

It occurs more than once, it depends on the number of objects. And yet, it occurs only when more than 3 objects are welded together.
Here is the code (I signed the line with an error in case of a numbering failure):

using Godot;
using System;
using System.Collections.Generic;

public partial class sample : RigidBody3D
{
	[Export]
	Color color;
	[Export]
	bool weld;
	[Export]
	bool weldable;

	bool f = true;
	bool welded = false;

	Dictionary<Node3D, sample> samples = new Dictionary<Node3D, sample>();
	List<Node> nodes = new List<Node>();

	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		GetNode<CsgMesh3D>("Mesh").Material = new StandardMaterial3D
		{
			AlbedoColor = color
		};
	}


	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
		if (f)
		{
			f = false;
			welded = true;


		}
	}

	public void Unweld()
	{
		if (welded)
		{
			welded = false;
			Vector3 MassCenter = CenterOfMass;
			foreach (var n in GetNode("Welded").GetChildren())
			{
				Node3D ob = (Node3D)n;
				sample a = samples[ob];
				Mass -= a.Mass;
				a.welded = false;
				a.Position = ob.GlobalPosition;
				a.Rotation = ob.GlobalRotation;
				//a.LinearVelocity = (a.Position - MassCenter).Normalized();

				GetParent().AddChild(a);
				a.Unweld();
				n.QueueFree();
			}
			foreach (var n in nodes)
			{
				RemoveChild(n);
				n.QueueFree();
			}
		}
	}

	private void body_entered(Node3D body)
	{
		if (body.GetType() == typeof(sample) && f && !welded && body != this)
		{
			sample sbody = (sample)body;
			if (!sbody.welded && sbody.weldable)
			{
				sbody.welded = true;
				
				Node3D swnode = new Node3D();
				GetNode("Welded").AddChild(swnode);
				swnode.Position = sbody.Position - Position;
				swnode.Rotation = sbody.Rotation - Rotation;

				Mass += sbody.Mass;
				foreach (Node3D o in sbody.GetChildren())
				{
					Node3D C = (Node3D)o.Duplicate(); //error here
					nodes.Add(C);
					C.Position += sbody.Position - Position;
					C.Name = C.GetHashCode().ToString();
					AddChild(C);
				}
				samples.Add(swnode, sbody);
				GetParent().RemoveChild(sbody);
			}

		}
	}
}

Perhaps it’s worth explaining what’s going on here. This is the code of a single object. There are several of them on the stage, next to each other. At the very beginning of the game, they “weld” and become a solid object. Also, there is a function that is all unweld.
Please help me figure out what’s going on and fix that damn mistake, and then this game will be the killer of the Finals