Invalid call to function '…' in base '…'. Expected N argument(s) in Godot 4
By Eduardo Orellana · Updated
The function was called with a different number of arguments than it declares. target.take_damage() on a function declared take_damage(amount: int) stops with Invalid call to function 'take_damage' in base 'Node (repro.gd)'. Expected 1 argument(s); pass the argument, target.take_damage(10), or give the parameter a default value.
What Godot is checking
When a GDScript function is called, the VM compares the number of arguments passed with the number the function declares. Fewer than its parameters without a default value is too few, and the error's number is that count. More than all its parameters, on a function that is not variadic, is too many, and the number is the full parameter count.
The base in the message names what the call ran on: the class of the object, then the script attached to it in brackets, here 'Node (repro.gd)'.
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.
The analyzer has its own check, which stops the script at parse time with Too few arguments for "take_damage()" call. Expected at least 1 but received 0. In the repro the call goes through an untyped variable, var target = get_node("."), and the run shows that it parsed and failed only when it ran.
Reproduce it
A node with a take_damage(amount) function, called through an untyped variable with no argument.
extends Node
var health := 100
func take_damage(amount: int) -> void:
health -= amount
func _ready() -> void:
var target = get_node(".")
target.take_damage()
print("after")
What Godot 4.7.2 prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
SCRIPT ERROR: Invalid call to function 'take_damage' in base 'Node (repro.gd)'. Expected 1 argument(s).
at: _ready (res://answers/invalid-call-to-function-expected-arguments/repro.gd:10)
GDScript backtrace (most recent call first):
[0] _ready (res://answers/invalid-call-to-function-expected-arguments/repro.gd:10)Fix it
Pass the argument the function declares.
extends Node
var health := 100
func take_damage(amount: int) -> void:
health -= amount
func _ready() -> void:
var target = get_node(".")
target.take_damage(10)
print("health ", health)
What the fixed script prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
health 90Too many arguments names the full count
Passing more arguments than the function declares fails the same way, and the number is every parameter, defaults included. A function declared take_damage(amount: int, source = null) called with three arguments reports Expected 2 argument(s); called with none it reports Expected 1 argument(s), because source has a default.
func take_damage(amount: int, source = null) -> void:
health -= amount
The same error in earlier Godot versions
Godot 4.2 and Godot 3.6 printed it as: Invalid call to function '…' in base '…'. Expected 1 arguments. The cause and the fix are the same.
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 182, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_vm.cpp#L182), [gdscript_vm.cpp lines 561 to 573, the argument count check](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_vm.cpp#L561-L573), [gdscript_vm.cpp line 2108, the function and base in the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_vm.cpp#L2108), [gdscript_analyzer.cpp line 6075, the parse-time check](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_analyzer.cpp#L6075).
Questions
- Why does the message say 'Expected 1 arguments' in my Godot version?
- Godot 4.2 and Godot 3.6 print Expected 1 arguments. Godot 4.7.2 prints Expected 1 argument(s). It is the same check.
- Why didn't the editor flag the call?
- The analyzer checks the argument count when it knows which function is called. Through an untyped variable it does not, so the call is checked when it runs, as in the repro.
Related
- Invalid call. Nonexistent function 'instance' in base 'PackedScene'
- Invalid access to property or key on a base object of type 'Nil'
- Every verified Godot 4 answer
- Invalid type in static function '…' in type '…'. Cannot convert argument in Godot 4
- Trying to call an async function without "await" in Godot 4
- Trying to assign a non-object value to a variable of type '…' in Godot 4
- Invalid assignment of property or key with value of type on a base object of type 'Nil' in Godot 4
- Invalid access to property or key on a base object of type 'null instance' in Godot 4
Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.
Download Flockbay free