Skip to content

Could not find base class "KinematicBody2D" in Godot 4: it is CharacterBody2D now

By Eduardo Orellana · Updated

KinematicBody2D is called CharacterBody2D in Godot 4, and KinematicBody is CharacterBody3D. A Godot 3 script that extends KinematicBody2D fails to parse with Could not find base class "KinematicBody2D". Extend CharacterBody2D, set the body's velocity property, and call move_and_slide() with no arguments.

AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.

Intel or AMD Chromebook, with Linux turned on.

Download for macOSDownload for WindowsDownload for Linux

What Godot is checking

When GDScript loads a script, the analyzer resolves the class named after extends. KinematicBody2D is not a class in Godot 4, so the script fails to parse and nothing in it runs. The node's type in the scene is not the problem; the script is.

Godot 4 renamed the class. Its 3-to-4 converter carries the pair in its renames table: KinematicBody2D to CharacterBody2D, and KinematicBody to CharacterBody3D.

The rename comes with a change you hit right after: move_and_slide() takes no arguments in Godot 4. The body moves by its velocity property, and the old arguments are properties too: up_direction, floor_stop_on_slope, floor_max_angle and max_slides. A Godot 3 call such as move_and_slide(Vector2(60, 0)) fails to parse with Too many arguments for "move_and_slide()" call. Expected at most 0 but received 1.

More on this: The best AI for GDScript: what good output looks like

Reproduce it

A Godot 3 player script, moved into a Godot 4 project. The scene is one CharacterBody2D with this script.

GDScript
extends KinematicBody2D

func _physics_process(delta):
	move_and_slide(Vector2(60, 0))

What Godot 4.7.2 prints

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

SCRIPT ERROR: Parse Error: Could not find base class "KinematicBody2D".
   at: GDScript::reload (res://answers/kinematicbody2d-in-godot-4/repro.gd:1)
ERROR: Failed to load script "res://answers/kinematicbody2d-in-godot-4/repro.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript_resource_format.cpp:46)

Fix it

Extend CharacterBody2D, set velocity, and call move_and_slide() with no arguments. The run prints where the body is after ten physics frames at 60 per second.

More on this: Godot 3 to Godot 4: the converter, then the errors it leaves

GDScript
extends CharacterBody2D

var frames := 0

func _physics_process(_delta: float) -> void:
	velocity = Vector2(60, 0)
	move_and_slide()
	frames += 1
	if frames == 10:
		print("position after 10 physics frames: ", position)
		get_tree().quit()

What the fixed script prints

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

position after 10 physics frames: (10.0, 0.0)

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.

Prompt
My Godot project was written for Godot 3 and Godot 4 stops on this: "Parse Error: Could not find base class "KinematicBody2D".". Port every use to Godot 4. KinematicBody2D is called CharacterBody2D in Godot 4, and KinematicBody is CharacterBody3D. A Godot 3 script that extends KinematicBody2D fails to parse with Could not find base class "KinematicBody2D". Extend CharacterBody2D, set the body's velocity property, and call move_and_slide() with no arguments. Then run the game headless and check Godot's output for errors.

The 3D body: KinematicBody is CharacterBody3D

The 3D class took the same rename, KinematicBody to CharacterBody3D, with the same move_and_slide() change: set velocity, then call it with no arguments.

More on this: Spatial in Godot 4: Could not find base class "Spatial"

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_analyzer.cpp line 572, the message, renames_map_3_to_4.cpp lines 1533 to 1534, the rename, CharacterBody2D in the class reference.

Questions

Where did move_and_slide's arguments go?
They became properties of CharacterBody2D: velocity for the motion, and up_direction, floor_stop_on_slope, floor_max_angle and max_slides for the rest. move_and_slide() reads them and updates velocity after a collision.
Why does an AI assistant keep writing KinematicBody2D?
Most GDScript written before 2023 targets Godot 3, so models trained on it often write Godot 3 names. The parse error at the top of this page is the one that code hits 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