@_ready(): Node not Found, but it still works

Godot Version

4.2.1

Question

I have a CanvasLayer which contains a control node that has all of my UI elements
but for some reasion the debugger says
ui.gd:3 @ _ready(): Node not found: "Control/top_bar" (relative to "/root/Ui")
and it repeats for all of the nodes added to the script, the code looks like this:

extends CanvasLayer

@onready var main_top_bar = $Control/top_bar
@onready var main_buttons = $Control/Main/Main_Buttons
@onready var animation_player = $Control/top_bar/AnimationPlayer

but more confusingly it works
i can still use my buttons and others that are in the script below these

My scene tree looks like this:

How can i fix the error?

The only explanation I can think of is that the UI script is also assigned to some other node by mistake.