Error when removing node from group in code ("!data.grouped.has(p_identifier)" is true)

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

Hi All!

I’ve recently started seeing this error in the debugger when removing a node from a group in gdscript. Does anyone know what causes it? It’s not doing anything to the game…

E 0:00:33.898 remove_from_group: Condition “!data.grouped.has(p_identifier)” is true.
<C++ Source> scene/main/node.cpp:1697 @ remove_from_group()

Please take a look at the link below and note the following comment:
“Try using call_deferred with a function used to process the removal of the node.”

Game crash when removing a node from the scene #21459

gp1 | 2020-05-27 15:20

Thank you. BTW, would you know what the correct syntax is for call deferref with removal from group? I used call_deferred with add child before: call_deferred("add_child", childnode). But trying call_deferred("remove_from_group", "group_name") does not work…

Macryc | 2020-06-07 20:17

When I changed this:

call_deferred("remove_from_group", "group_name")

to this:

call_deferred("self.remove_from_group", "group_name")

the error went away.
If this doesn’t work then a sample project could maybe be beneficial.

gp1 | 2020-06-07 22:32