Odd behavior looping through Dict with WorkerThreadPool

Godot Version

4.4.1

Question

i have Problems with mulithreading.

script:

var factions_units : Dictionary [Faction,Array]
...
func get_unit_faction(p_unit : Unit)->Faction:
	print("Faction Keys" + str(factions_units.keys())) 

	for faction : Faction in factions_units:
		print(faction.name) 
		if factions_units[faction].has(p_unit):
			return faction
			
	return null

Faction is a Node2D containing some meta information about the faction and the unit nodes.

class_name Faction
extends Node2D


@export var is_ai_controlled : bool = true
@export var allys : Array[Faction]
@export var enemys : Array[Faction]


func _ready() -> void:
	y_sort_enabled = true

When i use WorkerThreadPool the outputs are
outpunts Faction Keys[, ]
outpunts Green

The dictionary is not changed while the WorkerThreadPool ist busy. Why are there two empty(?) keys but the faction node can still be accessed?

The Programm than crasches on if factions_units[faction].has(p_unit):

Invalid access to property or key of type ‘Node2D (Faction)’ on a base object of type ‘Dictionary[Faction, Array]’.

if im doing it without a WorkerThreadPool the output is
Faction Keys[Green:<Node2D#134150622907>, Red:<Node2D#136314883900>]
Green

The Script works without a WorkerThreadPool
since its working without threads, i wonder what is causing this? Its my first time working with threads. Im only Reading and not mutating data. According to the documentation, dicts a threadsafe if you want to read them.

factions_units[factions_units.keys()[0]][0].name

gives me the node name of the unit i expected, The data seems to be here but not accessible as im used to.

i made a minimal example:
scene

#node/class faction
class_name Faction
extends Node

#node/class unit
class_name Unit
extends Node2D
#root node
extends Node2D
@onready var faction: Faction = %faction
@onready var unit: Unit = %unit
var dict_data: Dictionary[Faction,Array] = {}

func _ready() -> void:
	dict_data = {faction: [unit]}
	var group_task_id = WorkerThreadPool.add_group_task(_test_thread,1)#wont work
	WorkerThreadPool.wait_for_group_task_completion(group_task_id)
	_test_thread(0) #works
	print(dict_data)
	
func _test_thread(p_index)->void:
	for key: Faction in dict_data:
		for unit: Unit in dict_data[key]:
			print(unit.name)

Possible Solution

changeging
var dict_data: Dictionary[Faction,Array] = {}
to var faction_data: Array = [faction_node,…] with only factions nodes seems to work. the factions node then contains the unit nodes.

i wonder: is this a Bug or am i using it wrong?