Too few arguments for "…()" call. Expected at least N but received M in Godot 4
By Eduardo Orellana · Updated
The call passes fewer arguments than the function's required parameters. heal(5) on func heal(amount: int, source: String) fails to parse with Too few arguments for "heal()" call. Expected at least 2 but received 1. Pass every required argument, or give the later parameters default values.
AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.
Intel or AMD Chromebook, with Linux turned on.
What Godot is checking
When the analyzer knows which function is called, it counts the parameters without a default value and compares them with the arguments. Too few stops the script at load time.
When it cannot know, through an untyped variable, the count is checked at run time instead and the message is Invalid call to function 'heal' in base '…'. Expected 2 argument(s).
Reproduce it
A heal(amount, source) function called with one argument.
extends Node
func heal(amount: int, source: String) -> void:
print("healed ", amount, " by ", source)
func _ready() -> void:
heal(5)
What Godot 4.7.2 prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
SCRIPT ERROR: Parse Error: Too few arguments for "heal()" call. Expected at least 2 but received 1.
at: GDScript::reload (res://answers/too-few-arguments-for-call-expected-at-least/repro.gd:7)
ERROR: Failed to load script "res://answers/too-few-arguments-for-call-expected-at-least/repro.gd" with error "Parse error".
at: load (modules/gdscript/gdscript_resource_format.cpp:46)Fix it
Give the second parameter a default, so both calls work.
extends Node
func heal(amount: int, source: String = "potion") -> void:
print("healed ", amount, " by ", source)
func _ready() -> void:
heal(5)
heal(5, "fountain")
What the fixed script prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
healed 5 by potion
healed 5 by fountainVerified 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 18 October 2026, and the output above is what Godot printed, unedited.
Where the check lives in Godot's source: [gdscript_analyzer.cpp line 6075, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_analyzer.cpp#L6075).
Questions
- Can default parameters come before required ones?
- No. Once a parameter has a default, every parameter after it needs one too.
- Does this apply to signals I emit?
- Emitting with fewer arguments than the signal declares is not checked at parse time; the connected methods fail when they are called.
Related
- Invalid call to function '…' in base '…'. Expected N argument(s)
- Invalid argument for "…()" function: argument 1 should be "…"
- Every verified Godot 4 answer
- Invalid type in static function '…' in type '…'. Cannot convert argument in Godot 4
- Cannot get return value of call to "…()" because it returns "void" in Godot 4
- Trying to return a value of type "…" from a function whose return type is "…" in Godot 4
- How to connect signals in code in Godot 4: signal.connect(callable)
- How to parse JSON in Godot 4: JSON.parse_string()
Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.
Download Flockbay free