Quick answer: The call passes a number of arguments the function’s signature does not allow. Expected at least N counts the parameters that have no default value; Expected at most N counts all of them. Look up the signature and match it. In ported code, move_and_slide() now takes nothing and reads the velocity property. In your own code, update the callers or give the new parameter a default value.
Both messages come from the same check: GDScript counts the arguments at a call site and compares the total with the function’s parameter list before the script ever runs. That makes them cheap errors, caught in the editor with the line underlined. The time goes into working out which signature Godot compared against, because it is not always the one you had in mind: a Godot 3 version of an engine function, a parent class’s constructor, or a method with the same name on a different class. The sections below cover each of those, the fixes with default values and Callable.bind(), and the runtime message you get when the type is unknown.
- The two errors
- What causes them
- See the signature Godot is using
- Fix 1: Godot 3 calls that changed shape
- Fix 2: update the callers, or add a default
- Fix 3: constructors and .new()
- Fix 4: super and overrides
- Fix 5: bind the arguments when something else makes the call
- The runtime form of the same mistake
- How to confirm the fix
- What a player build can tell you
- Related guides
- Frequently asked questions
The two errors
Too few arguments for "take_damage()" call. Expected at least 2 but received 1.
Too many arguments for "move_and_slide()" call. Expected at most 0 but received 2.
The quoted name is the function being called; for a constructor it is new(). “At least” is the count of parameters without a default value, and “at most” is the full parameter count, so a function declared as func fire(dir: Vector2, speed := 400.0) accepts one or two arguments and reports “at least 1” or “at most 2”.
These are parse errors. The script will not load until the line is fixed, and the check only happens where Godot knows the function’s signature while parsing: calls on self, on variables with a type, on class names, and on built-in functions such as lerp(). Built-in type constructors have their own wording for the same mistake: No constructor of "Vector2" matches the signature "Vector2(int)".
What causes them
- A Godot 3 call to a function whose signature changed.
move_and_slide(velocity, Vector2.UP)is the classic. The four-argument form ofconnect()is the other common one. - Your own function gained or lost a parameter and one call site was missed. The error appears in the caller’s file, not in the file you edited.
- A class whose
_init()has required parameters is created with a bare.new(). - A
super()call that does not pass the parent’s arguments. - A similarly named function with a different shape.
randi(10)whererandi_range(0, 9)was meant,rotate(0.1)on aNode3D(which needs an axis and an angle, unlikeNode2D),tween_property()without the duration. - A decimal comma.
lerp(a, b, 0,5)is four arguments. GDScript only accepts a point as the decimal separator.
See the signature Godot is using
- Ctrl+click the function name (Cmd+click on macOS). For your own function the editor jumps to its definition; for an engine function it opens the class reference entry, where optional parameters are the ones shown with
= value. - Delete the opening parenthesis and type it again. The editor shows a call hint with the parameter list and highlights the one you are on.
- Press F1 and search for the function. If several classes list it, check which class your variable is typed as. Godot 4.4 and later also show the signature when you hover the name.
Engine calls that are miscounted most often:
| Function | Arguments |
|---|---|
CharacterBody2D.move_and_slide() | None. Set velocity first |
randi(), randf() | None. For a range use randi_range(from, to) or randf_range(from, to) |
lerp(from, to, weight), clamp(value, min, max) | Exactly 3 |
Tween.tween_property(object, property, final_val, duration) | Exactly 4 |
Input.get_axis(negative_action, positive_action) | Exactly 2 |
Input.get_vector(negative_x, positive_x, negative_y, positive_y) | 4, plus an optional deadzone |
Node2D.rotate(radians) / Node3D.rotate(axis, angle) | 1 / 2 |
Vector2.rotated(angle) / Vector3.rotated(axis, angle) | 1 / 2 |
Fix 1: Godot 3 calls that changed shape
Godot 3 movement code passed the velocity in and took the result back:
# Godot 3
extends KinematicBody2D
var velocity := Vector2.ZERO
func _physics_process(delta: float) -> void:
velocity.y += 980.0 * delta
velocity = move_and_slide(velocity, Vector2.UP)
In Godot 4, velocity is a built-in property of the body, the up direction is the up_direction property (which already defaults to up), and move_and_slide() takes no arguments and returns whether a collision happened:
# Godot 4
extends CharacterBody2D
func _physics_process(delta: float) -> void:
velocity.y += 980.0 * delta
move_and_slide()
Delete your own var velocity line as well, because it now clashes with the built-in property. If the old code called move_and_slide_with_snap(), that function is gone and you get a different error, covered in the “Function not found in base self” guide.
Signal connections changed in the same way. Godot 3 took a target, a method name and an array of extra values; Godot 4 takes one Callable:
# Godot 3: Too many arguments for "connect()" call. Expected at most 3 but received 4.
$Button.connect("pressed", self, "_on_pressed", [slot_id])
# Godot 4
$Button.pressed.connect(_on_pressed.bind(slot_id))
A warning for anyone porting: a matching count does not mean a matching meaning. move_and_collide() still accepts a second argument, but in Godot 3 it was infinite_inertia and in Godot 4 it is test_only. RigidBody2D.apply_impulse() swapped its order from (offset, impulse) to (impulse, position). Neither produces an error, so check the signature of every physics call you carry over.
Fix 2: update the callers, or add a default
You add a parameter to a function:
# enemy.gd
class_name Enemy
extends CharacterBody2D
var health := 30
func take_damage(amount: int, source: Node) -> void:
health -= amount
print("hit by ", source.name)
and a script you have not opened in weeks stops compiling:
# spikes.gd
extends Area2D
func _on_body_entered(body: Node2D) -> void:
var enemy := body as Enemy
if enemy:
enemy.take_damage(10) # Expected at least 2 but received 1.
If every caller should supply the value, pass it: enemy.take_damage(10, self). If the value is optional, say so in the signature and handle its absence:
func take_damage(amount: int, source: Node = null) -> void:
health -= amount
if source:
print("hit by ", source.name)
Parameters with defaults must come after the ones without. Use Search > Find in Files for take_damage( after any signature change; scripts are parsed when they are loaded, so a broken caller in another scene will not show up until that scene runs.
Fix 3: constructors and .new()
Arguments to .new() go to _init():
# item.gd
class_name Item
extends Resource
@export var id := ""
@export var count := 1
func _init(p_id: String, p_count: int) -> void:
id = p_id
count = p_count
var potion := Item.new("potion") # Too few arguments for "new()" call. Expected at least 2 but received 1.
Passing both values fixes this line, but a resource or node script has a second caller: the engine. Loading a .tres file, creating the resource in the Inspector or instancing a scene all construct the object with no arguments, and a required _init() parameter makes that fail at load time. Give every parameter a default:
func _init(p_id: String = "", p_count: int = 1) -> void:
id = p_id
count = p_count
Fix 4: super and overrides
Inside a function, a bare super(...) calls the parent’s version of that same function, and it needs the parent’s arguments:
# weapon.gd
class_name Weapon
extends RefCounted
var damage := 0
func _init(p_damage: int) -> void:
damage = p_damage
func attack(target: Node, multiplier: float) -> void:
print(target.name, " takes ", damage * multiplier)
# sword.gd
extends Weapon
func _init() -> void:
super(12) # super() alone is "Too few arguments"
func attack(target: Node, multiplier: float) -> void:
super(target, multiplier * 1.5)
The child’s constructor may take different parameters from the parent’s, as here. An ordinary override may not: change its parameter list and Godot reports The function signature doesn't match the parent. followed by the parent’s signature. Extra parameters on an override are allowed only when they have defaults.
Fix 5: bind the arguments when something else makes the call
Sometimes the function is right and the caller is a timer, a signal or a tween that will call it with fewer arguments than it needs. Do not strip the parameters. Attach the missing values to the callable:
extends Node2D
@export var enemy_scene: PackedScene
func spawn(scene: PackedScene, at: Vector2) -> void:
var node := scene.instantiate() as Node2D
node.position = at
add_child(node)
func _ready() -> void:
$SpawnTimer.timeout.connect(spawn.bind(enemy_scene, Vector2(400, 120)))
timeout sends nothing and bind() supplies both values, so spawn() receives the two it requires. Bound values are appended after whatever the caller passes. Get that count wrong and nothing is flagged in the editor; the mismatch appears when the signal fires, as described in “Error calling from signal: Method expected 0 arguments”.
The runtime form of the same mistake
When the variable has no type, or its type is a base class that does not declare the function, there is nothing to check while parsing:
func _on_body_entered(body: Node2D) -> void:
body.take_damage(10) # Node2D has no take_damage(), so this is resolved at runtime
The game runs until that line executes, then the debugger stops with:
Invalid call to function 'take_damage' in base 'CharacterBody2D (enemy.gd)'. Expected 2 arguments.
The part in brackets is the script’s file name or its class_name. You see this in the editor and in debug exports. Release export templates leave out much of GDScript’s runtime checking, so do not rely on a release build to report it. The durable fix is to give the variable a type (var enemy := body as Enemy), which moves the check back to the editor.
How to confirm the fix
The underline disappears when the count is legal, which only proves that one line. After changing a signature, search the project for every call, then run each scene that contains a caller. For a constructor change, also open any .tres files and scenes that use the class and check the Output panel for load errors. For a port from Godot 3, play the result: a call with a legal count and a changed meaning passes every check and still moves the character wrongly.
What a player build can tell you
Bugnet does nothing for the parse error itself; the editor already has it. Its use is with the forms that get past the editor. Bugnet’s Godot SDK reads the engine’s log file for automatic capture, so with File Logging enabled (it is off by default on mobile exports) an error the engine writes there, such as a script that failed to load or a signal handler skipped for the wrong argument count, can reach your dashboard with platform, OS and game version attached, and repeats stack under one title. Since release builds do not reliably log script-level call errors, add a guard where a wrong call would be costly and send it yourself with report_error(message, stack). The SDK setup is in the SDK docs.
Related guides
- How to Fix “Function not found in base self” in Godot 4
- How to Fix “Error calling from signal: Method expected 0 arguments, but called with 1” in Godot
- How to Fix “Invalid type in function: Cannot convert argument” in Godot
- How to Fix “Invalid call. Nonexistent function” in Godot
- How to Fix “Could not find type in the current scope” in Godot 4
Frequently asked questions
What does Too few arguments for call mean in Godot 4?
The call passes fewer arguments than the function requires. The number after Expected at least is how many parameters have no default value. Pass the missing arguments, or give those parameters default values in the function’s declaration so they become optional.
Why does move_and_slide give Too many arguments in Godot 4?
In Godot 4 move_and_slide takes no arguments. Velocity is a built-in property of CharacterBody2D and CharacterBody3D, and the up direction is the up_direction property. Set velocity, then call move_and_slide with empty parentheses.
How do I make a function parameter optional in GDScript?
Give it a default value in the declaration, for example a source parameter that defaults to null. Optional parameters must come after all required ones. Callers can then omit them, and the function should handle the default case.
Why does calling new on my class say Too few arguments?
Arguments passed to new are forwarded to the class’s _init function. If _init declares parameters without default values, every call to new must supply them. For resources and node scripts, give all _init parameters defaults, because the engine constructs them with no arguments.
Why is there no error in the editor but Invalid call to function at runtime?
The editor can only count arguments when it knows the function’s signature. If the variable is untyped, or typed as a base class without that function, the check is deferred until the line runs. Type the variable as the script’s class to get the error while editing.
At least counts the parameters without defaults and at most counts them all. When the number in the message surprises you, Godot is looking at a different function than you are, so Ctrl+click the name before changing anything.