Introducing Dragonfly Cloud! Learn More

Error: godot could not find base class

Resolving "Godot Could Not Find Base Class" Error

This error occurs when Godot can't locate or load a parent class that your script is trying to extend. Here are specific steps to diagnose and fix the issue.

Common Causes and Solutions

  1. Incorrect Class Name

    • Double-check the spelling and capitalization of the base class
    • Example:
      extends KinematicBody # Correct extends kinematicbody # Incorrect (case sensitive)
  2. Missing or Incorrect Path

    • Ensure the base class script exists and the path is correct
    • For built-in classes, no path is needed
    • For custom classes:
      extends "res://path/to/base_class.gd"
  3. Class Name vs. File Name Mismatch

    • If using class_name, ensure it matches usage
    • Example:
      # In BaseClass.gd class_name BaseClass extends Node # In child script extends BaseClass # This should work now
  4. Circular Dependencies

    • Check for scripts that extend each other
    • Refactor to remove circular references
  5. Plugin Issues

    • If the base class is from a plugin, ensure the plugin is enabled
    • Project > Project Settings > Plugins > Enable the relevant plugin
  6. Autoload Problems

    • If the base class is an autoload, verify it's properly set up
    • Project > Project Settings > AutoLoad > Check if it's listed and enabled
  7. Script Language

    • Ensure you're not mixing GDScript with other languages like C#
    • GDScript can only extend GDScript or built-in classes

Step-by-Step Troubleshooting

  1. Verify Script Syntax

    • Open the script with the error
    • Check the extends line for typos
    • Ensure proper indentation and no extra spaces
  2. Check File Location

    • Confirm the base class script is in the correct folder
    • Update the path if you've moved files
  3. Reload Project

    • Sometimes Godot needs a refresh
    • Project > Tools > Reload Current Project
  4. Clear Script Cache

    • Help > Clear Script Cache
    • Restart Godot
  5. Use Full Paths

    • Try using full paths for custom classes
    • Example:
      extends "res://scripts/base_class.gd"
  6. Check for Warnings

    • Look in the Output panel for any related warnings
    • Address any issues mentioned
  7. Simplify and Test

    • Temporarily change to a built-in class (e.g., extends Node)
    • If it works, gradually reintroduce complexity
  8. Version Check

    • Ensure you're using a stable Godot version
    • Update to the latest stable release if possible

If the error persists after trying these steps, share your specific script contents and project structure on the Godot Q&A platform or forums for more targeted assistance.

Was this content helpful?

Start building today 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.