Calling reparent causes "Condition p_elem->_root != this"

My scene setup is the following:

  • Scene Root
    – SubViewport
    – Sprite2D that uses SubViewport output texture
    – ConrentRoot Node2D
    ---- A list of child nodes to SceneRoot

Godot script is attached to the Scene Root node.

This is how I reparent:

@onready var contentRoot : Node2D = $ContentRoot
@onready var subViewport : SubViewport = $SubViewport

func _ready():
    contentRoot.reparent(subViewport)

This causes the following error:

remove: Condition "p_elem->_root != this" is true.
    <C++ Source> ./core/templates/self_list.h:80 @ remove()

The error appears multiple times when I first launch the game.

I tried to use call_deferred to no avail, like so:

func _ready():
    contentRoot.call_deferred("reparent", subViewport)

Does anyone have a clue on how to fix this issue?