NavigationAgent2D is_target_reachable always false

Godot Version

4.2.2

Question

I managed to set up my navigationPolygon and want to run a NavigationAgent2D on it. I set it up as a CharacterBody2D and the logic for the node is as such:

extends CharacterBody2D

@onready var navigation_agent = $NavigationAgent2D
var SPEED: float = 1
var target_position: Vector2
var move_ready: bool = false

func _ready():
	var start_position = Vector2(20,20)
	position = start_position
	target_position = Vector2(100,100)
	set_target_position(target_position)
	NavigationServer2D.map_changed.connect(warn) ### Wait for the map update so I won't get errors
	
func _physics_process(delta):
	if move_ready:
		if position.distance_to(target_position) > 0.5:
			var current_location = global_transform.origin
			var next_location = navigation_agent.get_next_path_position()
			print(navigation_agent.is_target_reachable())
			var new_velocity = (next_location - current_location).normalized() * SPEED
			velocity = new_velocity
			move_and_slide()

func warn(_data):
	move_ready = true
	
func set_target_position(target_pos: Vector2):
	navigation_agent.set_target_position(target_pos)

However, the print(navigation_agent.is_target_reachable()) command always returns false
The game map uses a TileMap, but it doesn’t have any navigation layer set.
All I use is a NavigationRegion2D which after baking shows the entire map as accessible.
What could be the issue here?

Found the problem: after rebaking the NavigationPolygon I did not set it as the NavigationRegions2D polygon.
After doing that another navigation_map has been created and the Agent moves as required.