"Bad address index" - what could cause this error?

Godot Version

4.6.stable

Question

I have the following class code. Some of it is left away for clarity’s sake:

@tool
extends GraphNode
class_name CompositeMaterialBuilderGraphNode

  <...>

  var _rename_button : Button
  var _confirm_button : Button
  signal request_edit_title
  signal request_stop_editing_title

func _node_ready() → void: ##Called after _ready() by [CompositeMaterialBuilderGraphNode] to allow extending classes to extend _ready() functionality without overriding base behavior.
  pass

func _ready() → void:
  theme = preload(“res://addons/CompositeMaterial/builder/graph_node_default_theme.tres”)

  _rename_button = Button.new()
  _rename_button.flat = true
  _rename_button.icon = EditorInterface.get_base_control().get_theme_icon("Edit", "EditorIcons")
  get_titlebar_hbox().add_child(_rename_button)

  await get_tree().create_timer(0.1)

  _confirm_button = Button.new()
  _confirm_button.flat = true
  _confirm_button.icon = EditorInterface.get_base_control().get_theme_icon("ImportCheck", "EditorIcons")
  get_titlebar_hbox().add_child(_confirm_button)
  _confirm_button.visible = false

  if !_confirm_button.is_connected("button_down", request_stop_editing_title.emit): #just for preventing errors when the template page gets loaded in
	_confirm_button.button_down.connect(request_stop_editing_title.emit)
	_rename_button.button_down.connect(start_capturing_keyboard)

  _node_ready()

For whatever reason, when creating the second button, Godot pushes this error to the output:

res://addons/CompositeMaterial/builder/GraphNodes/CompositeMaterialBuilderGraphNode.gd:30 - Bad address index. (Line 30 is _confirm_button = Button.new())

I’ve traced it back to be something to do with the GDScript server, but I’m still in the dark about what exactly causes this error. The result is that the button doesn’t get created at all.

Does anybody have any idea what could cause this?

Seems like just restarting the editor fixed my issue. Still not sure what exactly the problem was, but it was probably nothing to do with my code.