# Invalid type in static function 'from_angle' in type 'Vector2'. Cannot convert argument 1 from String to float in Godot 4

A static function was called with an argument whose type cannot be converted to the parameter's type. Vector2.from_angle(data.angle), where data.angle is the String "1.5" from JSON, stops with Invalid type in static function 'from_angle' in type 'Vector2'. Cannot convert argument 1 from String to float; convert the value first, Vector2.from_angle(float(data.angle)).

Source: https://flockbay.com/godot/invalid-type-in-static-function-cannot-convert-argument/ · Updated 2026-10-30

## What Godot is checking

When a static function of a built-in type such as Vector2 is called, the arguments are checked against the types the function declares. If one cannot be converted, the call fails, and the VM names the function, the type it belongs to, the argument's position counted from 1, the type it got and the type the parameter expects.

The same message is built for static functions of engine classes, with the class name after in type, from the second static call path in the VM.

It is a runtime error: the script parsed, and the error appeared when the line ran. The function that made the call stops there, so the print("after") below it never ran, as the output shows.

JSON.parse_string() returns a Variant, so the analyzer does not know that data.angle holds a String, and the call is checked only when it runs.

## Reproduce it

An angle read from JSON, stored as a string, passed straight to Vector2.from_angle(), which takes a float.

```
extends Node

func _ready() -> void:
	var data = JSON.parse_string('{"angle": "1.5"}')
	var direction := Vector2.from_angle(data.angle)
	print("after")

```

## What Godot 4.7.2 prints

```
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

SCRIPT ERROR: Invalid type in static function 'from_angle' in type 'Vector2'. Cannot convert argument 1 from String to float.
   at: _ready (res://answers/invalid-type-in-static-function-cannot-convert-argument/repro.gd:5)
   GDScript backtrace (most recent call first):
       [0] _ready (res://answers/invalid-type-in-static-function-cannot-convert-argument/repro.gd:5)
```

## Fix it

Convert the value to the parameter's type before the call. float() converts a String the same way String.to_float() does.

```
extends Node

func _ready() -> void:
	var data = JSON.parse_string('{"angle": "1.5"}')
	var direction := Vector2.from_angle(float(data.angle))
	print("direction ", direction)

```

## What the fixed script prints

```
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

direction (0.070737, 0.997495)
```

## Run this fix with your agent

Flockbay is the Godot editor with an AI agent built in. Paste this into Flockbay's chat, or into Claude Code or Codex connected to Flockbay over MCP: the agent finds the cause in your project, applies the fix, runs the game headless and reads Godot's output to check it.

```
My Godot 4 project prints this error: "Invalid type in static function 'from_angle' in type 'Vector2'. Cannot convert argument 1 from String to float.". Find where it comes from and fix it. A static function was called with an argument whose type cannot be converted to the parameter's type. Vector2.from_angle(data.angle), where data.angle is the String "1.5" from JSON, stops with Invalid type in static function 'from_angle' in type 'Vector2'. Cannot convert argument 1 from String to float; convert the value first, Vector2.from_angle(float(data.angle)). Then run the game headless and check that Godot's output no longer shows it.
```

## Verified on Godot 4.7.2

Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 6 October 2026, and the output above is what Godot printed, unedited.

Where the check lives in Godot's source: [gdscript_vm.cpp line 179, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_vm.cpp#L179), [gdscript_vm.cpp line 2143, static functions of built-in types](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_vm.cpp#L2143), [gdscript_vm.cpp line 2189, static functions of engine classes](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_vm.cpp#L2189), [Vector2.from_angle in the class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/Vector2.xml#L211), [JSON.parse_string in the class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/JSON.xml#L83), [float(String) in the class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/float.xml#L30).

## Questions

### Why didn't the editor flag the call?

JSON.parse_string() returns a Variant, so the type of data.angle is not known until the line runs. The repro parsed and failed only when the line ran.

### Did older Godot versions print a different message?

Godot 4.2 builds the same text: Invalid type in static function '…' in type '…'. Cannot convert argument N from A to B.

Download Flockbay free: Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot. https://flockbay.com/download/

Related: [Invalid argument for "…()" function: argument 1 should be "…" but is "…" in Godot 4](/godot/invalid-argument-for-function-argument-should-be/), [Invalid call to function '…' in base '…'. Expected N argument(s) in Godot 4](/godot/invalid-call-to-function-expected-arguments/), [Invalid cast: could not convert value to '…' in Godot 4](/godot/invalid-cast-could-not-convert-value/), [Trying to assign value of type 'String' to a variable of type 'int' in Godot 4](/godot/trying-to-assign-value-of-type-string-to-int/), [Every verified Godot 4 answer](/godot/), [How do I see Godot’s output and errors in Flockbay?](/docs/how-do-i-see-godots-output-in-flockbay/)
