Typecasting is fun, you should try it and clamp_vector(vector: Vector2, clamp_origin: Vector2, clamp_length: float) would give us more information.
The spot where your code is causing you some trouble you didn’t tell us about is most likely vector - clamp_origin
I don’t even want to calculate this in my brain, what you want to use is Vector2.distance_to