error(1950,1): The class "Player" couldn't be fully loaded (script error or cyclic dependency)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By tom47

Hi guys!

I recently re-organized my project’s file, and when I try to launch my test scene, it shows me the following error message:

“error(1950,1): The class “Player” couldn’t be fully loaded (script error or cyclic dependency)”

I don’t really get what does it mean as I didn’t modify this script (can it be due to the new position of the scene in the project?)

It prevents me from keep working on my project so if any of you know more details or how to resolve this error message that’ll be a great help!

Thanks and stay safe

When you changed the structure of your project and its files, how did you move around the files? Did you do it inside the editor, or with a file browser?

Ertain | 2020-05-19 08:11

Hello Ertain, thanks for your reply!

I did it outside the editor… guess it might have been a mistake because I had to fix many dependencies.

I think that I found the root of the problem which is an ;

error(27,1): The identifier “Inventory” isn’t a valid type (not a script or class), or couldn’t be found on base “self”.

Would you know something about that error?

tom47 | 2020-05-19 08:41

You may have found a solution that works for you, but I had this issue this morning and the issue was that I use a function of a static function inside the class by referencing the class inside the same class.

eg:

class_name myMathClass

static func sum(a,b):
      return a + b

static func multiplySumByTwo(a,b):
      return myMathClass.sum(a,b)

instead of

static func multiplySumByTwo(a,b):
      return sum(a,b)

since they were already in the same class

So the issue was in the same class, and it was just a silly mistake

LordCSD | 2022-04-20 18:15

just had the same issue, except the error was only in the script editor, when starting the game it works as intended. the solution of Marlin1846 solved the issue tho

zen3001 | 2022-07-08 17:49

:bust_in_silhouette: Reply From: njamster

This would be a lot easier to debug, if you would provide your script.

The identifier “Inventory” isn’t a valid type (not a script or class), or couldn’t be found on base “self”.

You’re likely doing something along the lines of var test : inventory - but as there is no built-in class with that name and you haven’t provided a custom class either, it’s considered an invalid type to define a variable with.

The class “Player” couldn’t be fully loaded (script error or cyclic dependency)

You’re likely doing something like this:

Player.gd

extends Node
class_name Player

func _ready():
    if get_parent() is SomethingElse:
        pass

SomethingElse.gd

extends Node
class_name SomethingElse

func _ready():
    if get_parent() is Player:
        pass

Each script depends on the other, so when loading one you enter an endless loop of dependencies (a so-called “cyclic dependency”). Also there is this issue.

This is exactly the problem I’m having. But what is the proper work around to determine if a given node is a given custom class type?

Synectome | 2021-06-28 16:19

:bust_in_silhouette: Reply From: Merlin1846

I know that this will probably not be helpful to you since it’s been 2 years but it could be helpful to the next person to have the problem. Try simply clicking the reload project button in the editor (top left corner) that fixed it instantly for me.

Guess what, your comment was helpful and just saved me a headache. +1

Axel DEAU | 2022-06-19 05:35

Thanks this helped me as well.

Sulius | 2022-08-04 08:43

Unbelievable! I’ve been struggling with this for over an hour. THANK YOU!

Syndog | 2022-08-15 15:38

Yep, same for me. I couldn’t figure out why Godot was claiming circular dependencies because as far as I could tell there weren’t any and all my paths were correct. Reloading the project seemed to fix the issue! Thanks!

baconandgames | 2022-08-22 02:34

I registered just to say thank you, this was driving me up the wall

Gisleburt | 2022-10-25 00:23