After stopping the game the console is still spammed with errors

Godot Version

Godot Engine v4.6.2-stable

Question

My Godot Engine project crashed because of an infinite while loop (I did that on an accident because the condition was written wrong).

Now everytime I open my project and launch the game the console will be spammed with this error.

The error by itself is wrong (and the error wasn’t even present before my project crashed. not to mention the “infinite while loop” was in absolutely different script called level.gd).

When I close the game the console is still spammed with this error. I can’t do anything to stop it.

In task manager the game instance is closed. Clearing console does not help.

Do you have a Tool script running?

Yeah turret_buy.gd is a Tool script.

And this is the one that prints the Error. A tool script is running in the editor, not just at runtime of the game.

Yeah but canvas_layer.gd does have the current_money variable. And it didn’t print any errors before I re-opened the project. Why the error then?

Without the code we could only guess.
The turret_buy.gdis trying to access the current_moneyand that is not available in the editor it seams. That’s what the Error is saying.

Here’s my code.

turret_buy.gd:

@tool
extends TextureButton

@onready var price_label : Label = $Label
@export var price : int = 70

func _process(_delta):
	if Gameplay.current_money < price:
		disabled = true
	else:
		disabled = false

canvas_layer.gd (it’s attached to CanvasLayer as an autoload with the name Gameplay

extends CanvasLayer

@onready var money_label : Label = $MarginContainer5/VBoxContainer/money/Label
@onready var gems_label : Label = $MarginContainer5/VBoxContainer/gems/Label

var current_money : int = 30
var current_gems : int = 0;

func _ready():
	process_mode = Node.PROCESS_MODE_ALWAYS

func _process(_delta):
	money_label.text = str(current_money)
	gems_label.text = str(current_gems)

To be honest, I would mark your message as the solution. I decided to remove @tool from turret_buy.gd (because my current logic doesn’t need it right now) and error was fixed.

Thank you so much for help!

AFAIK autoloads are not available in the editor, only at runtime.

Oh okay, thank you so much for response! It makes so much sense now.