godot: [TRACKER] Error macros with cryptic messages due to not having proper custom messages defined

If you stumble upon difficult-to-understand error messages (regardless of your skill level with Godot), please report them here. In your comment, make sure to state:

  • Your operating system and Godot version.
  • What you were doing when you got the error message. Always include code samples!
  • Ideally, a minimal reproduction project that returns the error message.

Note that this issue isn’t about reporting bugs, but reporting cryptic error messages. This issue is about improving error messages so users can figure things out by themselves more easily. If you stumble upon a bug, please open a dedicated issue instead of commenting in this tracker issue.

See https://github.com/godotengine/godot/issues/24199 for background.

Issues

For contributors

Even if you’re a beginner in C++, you should be able to add error macros.

To add error explanations to existing errors, search for their origin in the source code (by reading the automatically-generated error message), suffix the error macro with _MSG and add a parameter with a custom message at the end.

We recommend adding context (such as provided arguments versus expected ones) whenever possible. Some examples:

# Best, do this whenever possible:
"Can't listen server on port 420000. The port number must be between 1 and 65535."

# OK:
"Can't listen server on port 420000."

# Bad, this doesn't give much context:
"Can't listen server."

Here are some real-world examples of improving error explanations: https://github.com/godotengine/godot/pull/41352/files, https://github.com/godotengine/godot/pull/35862/files

See Error macros in the documentation for more information.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 12
  • Comments: 57 (23 by maintainers)

Commits related to this issue

Most upvoted comments

That’s not what the error checks, the node replacing with cannot have a parent, will add it to my PR

This seems to mean that you’re trying to set a Node’s owner to it’s current owner

No it means trying to set the owner of the node to itself, not its owner, it should have a description though saying that, it’s equivalent to the GDScript owner = self (this one now has a PR improving the message https://github.com/godotengine/godot/pull/95063)

image

  1. No clue what it even means. From the notes it seemed to be an issue with add_child() on a separate thread. Nothing here even hints at that being a potential causation.
  2. Where did this originate from? What function/script/node? I understand that’s probably hard to pass, because this seems a very in-engine error, but as a user that receives this, I have no clue what I’m doing wrong, what even caused this to happen, what the consequences are, or how to fix it.

image

  1. What’s the parent node that we’re performing get_child() on? What script/function called this?

I completely understand what’s going wrong, but the error doesn’t lead me to being able to fix anything in it’s current state. Especially since this could be caused by any of the MANY get_child() or $ references in an entire project.

This same error essentially happens for move_child() etc

  ERROR: Can't save resource to empty path. Provide non-empty path or a Resource with non-empty resource_path

This appears when saving any scene. It would be very helpful to know which resource is the problematic one. on restarting the editor it said something like res:// not found and during the next restart the error message disappeared

This is a known limitation, the rendering server doesn’t know the texture file or anything else like that (nor is it guaranteed to even be known), see:

Godot 3.5 image

The Object was deleted while awaiting a callback message should really be a warning or error, and could use more information on what the ‘object’ and the ‘callback’ are/were. Right now the only way to figure out what caused this is by looking at every Container in the entire project.

Godot 4.2.2

image

This seems to mean that you’re trying to set a Node’s owner to it’s current owner. Basically, you’re doing something inefficient. It should just say something along the lines of:

Trying to set Node as the owner of Node2, but Node is already the owner of Node2

`Although frankly, it would be better if it just:

1. Set it anyway, and didn’t complain. 2. Skipped it. 3. Gave a warning instead.

I see no reason for this to throw an ‘must fix’ error, since setting any other variable to it’s current value is allowed throughout the Engine.

Regarding this “Response header too big.” message, were you using an external script editor when it happened?

Nope, we only use the Godot Editor for our scripts. This error was something my co-developer had in Godot, and when I asked him if he had any clue what could be causing it, he said he had no idea. So I’m afraid I don’t currently have any other info. If we ever figure it out, I’ll let you know.

I think it would make a lot more sense if it said something like GLES2 does not support Sampler3D.

The new error message I added today should fit the bill 🙂

@Anutrix We probably want to use ANDROID_ENABLED as we use <platform>_ENABLED for other platform defines.

@Anutrix Maybe we should change the error message with an #ifdef depending on the target platform?