First of all, judging from both the video and the screenshots you provided (after I wrote my answer), you didn't apply my code but instead did this:
func _input(event: InputEvent) -> void:
global_position = lerp((get_viewport().get_mouse_position()),global_position,0.6)
move_and_slide(global_position, Vector2(0, 0))
So this error has nothing to do with my answer. Nor does it have anything to do with leaving the viewport. The error complains about collider
being a null instance, so my guess would be you freed the colliding instance somewhere else in your code.
By the way: the code you're using in your _input
-function moves the player twice. First by setting it's global_position
-property, then by using the move_and_slide
function (which expects a velocity vector, not a position vector).