godot: GDExtension error: Condition "_instance_bindings != nullptr" is true.

Godot version

4.0.dev (0ce3fff)

System information

Debian GNU/Linux bookworm/sid 64-bit, NVIDIA GM206 [GeForce GTX 960] (driver v470.103.01)

Issue description

Hi. Using godot alpha I’m getting the following error when attempting to use get_node in _ready:

ERROR: Condition "_instance_bindings != nullptr" is true.

I’m probably making use of _ready incorrectly but I am not sure.

Actually, what happens is that whatever code is inside _ready will be executed when the custom node is added to in the editor, not just when the game is launched. Is that the desired behavior for in example initialize default values for “exported” variables?

What this implies is that errors will be found when the node is added if the node needs some child and there are no find conditionals about them. I added a project example I was creating to report a possible error I found in 3.x that might be happening in 4.0 and I faced this error. Am I doing something wrong here?

Steps to reproduce

  • Create a gdextension
  • Add the custom node to the scene
  • Define virtual _ready override
  • Use get_node in the _ready method

Minimal reproduction project

git clone --recursive -b _instance_bindings_nullptr https://github.com/Karmavil/minimal.git

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (21 by maintainers)

Most upvoted comments

I can still reproduce this in https://github.com/godotengine/godot/issues/62152 (MRP is there). From what I can see this error is harmless, but there’s probably something going wrong.

I tried running OP’s MRP, but couldn’t get their CMake to work. After converting it to scons, I got other errors.

I can reproduce in https://github.com/godotengine/godot-cpp/tree/master/test though

$ godot4 --path test/demo
Godot Engine v4.0.alpha12.official.2c11e6d9e - https://godotengine.org
Vulkan API 1.2.0 - Using Vulkan Device #0: AMD - AMD Radeon RX 6800 XT
 
Constructor.
Signal bind

Static method calls
  static (109) 109
  void static
Instance method calls
  Simple func called.
  Simple const func called.
  Return something called.
  returned some string
  Return something const called.
ERROR: Condition "_instance_bindings != nullptr" is true.
   at: set_instance_binding (core/object/object.cpp:1665)
  returned const root:[Window:23941087638]
ExampleRef created.
  returned ref [ExampleRef:-9223372012225822184]
VarArg method calls
ExampleRef created.
ExampleRef created.
  Example ref checks called with value: -9223372012209045117, returning value: -9223372012192267910
  sending ref:  -9223372012209045117 returned ref:  -9223372012192267910
  Varargs (Variant return) called with 4 arguments
  vararg args 4
  Varargs (int return) called with 4 arguments
  vararg_nv ret 42
  Varargs (no return) called with 4 arguments
Method calls with default values
  defval (300) 300
  defval (250) 250
  defval (150) 150
Array and Dictionary
ExampleRef destroyed.
  test array [1, 2]
  test dictionary {"hello":"world", "foo":"bar"}
Properties
  custom position is (0, 0)
  custom position now is (50, 50)
Constnts
  FIRST 0
  ANSWER_TO_EVERYTHING 42
  CONSTANT_WITHOUT_ENUM 314
ExampleRef destroyed.

Reopening so we don’t lose track of this, but it might be a different issue (just producing the same result). We should re-verify with the same MRP and open a new issue in case.