Invalid assignment of property or key '…' with value of type '…' on a base object of type 'Node2D' in Godot 4
By Eduardo Orellana · Updated
The node has no property by that name, most often because of a typo. sprite.positon = Vector2.ZERO stops with Invalid assignment of property or key 'positon' with value of type 'Vector2' on a base object of type 'Node2D'. Fix the name (position); the Inspector shows every property's real name when you hover it.
AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.
Intel or AMD Chromebook, with Linux turned on.
What Godot is checking
Setting a property on an object asks the object to set it by name. When neither the class, its parents nor its script has a property of that name, the set fails and the VM reports the name, the value's type and the object's type.
On 4.7.2 this was a run-time error even with the variable typed Node2D, as the run shows: the script loaded, and the line failed when it ran.
Reproduce it
A Node2D whose position is set with a misspelled name.
extends Node
func _ready() -> void:
var sprite: Node2D = Node2D.new()
add_child(sprite)
sprite.positon = Vector2.ZERO
print("after")
What Godot 4.7.2 prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
SCRIPT ERROR: Invalid assignment of property or key 'positon' with value of type 'Vector2' on a base object of type 'Node2D'.
at: _ready (res://answers/invalid-assignment-of-property-or-key-on-node2d/repro.gd:6)
GDScript backtrace (most recent call first):
[0] _ready (res://answers/invalid-assignment-of-property-or-key-on-node2d/repro.gd:6)Fix it
Use the property's real name.
extends Node
func _ready() -> void:
var sprite: Node2D = Node2D.new()
add_child(sprite)
sprite.position = Vector2(32, 16)
print(sprite.position)
What the fixed script prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
(32.0, 16.0)A Godot 3 property name
Several properties were renamed in Godot 4: translation is position on Node3D, rect_position is position on Control, and modulate stayed. A Godot 3 name fails this way, or at parse time when the analyzer knows the class.
The same error in earlier Godot versions
Godot 4.2 and Godot 3.6 printed it as: Invalid set index 'positon' (on base: 'Node2D') with value of type 'Vector2'. The cause and the fix are the same.
More on this: Invalid assignment of property or key with value of type on a base object of type 'Nil' in Godot 4
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 18 October 2026, and the output above is what Godot printed, unedited.
Where the check lives in Godot's source: [gdscript_vm.cpp line 1235, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_vm.cpp#L1235).
Questions
- How do I find a property's exact name?
- Hover it in the Inspector: the tooltip shows the name scripts use. The class reference lists every property too.
- Can a script add its own property to a node?
- Declare it with var in the node's script. set() on a name the object does not have adds nothing; use set_meta() for ad hoc data.
Related
- Invalid assignment of property or key on type 'String'
- Spatial in Godot 4: it is Node3D now, and translation is position
- Every verified Godot 4 answer
- Invalid assignment of property or key with value of type on a base object of type 'Nil' in Godot 4
- How to get the class name of a node in Godot 4: get_class() and get_global_name()
- Invalid access to property or key on a base object of type 'Nil' in Godot 4
- Invalid assignment of index '…' (on base: 'Array') with value of type '…' in Godot 4
- Invalid access to property or key '…' on a base object of type 'Dictionary' 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