godot icon indicating copy to clipboard operation
godot copied to clipboard

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

Open Calinou opened this issue 5 years ago • 53 comments

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

  • [x] https://github.com/godotengine/godot/issues/42948
  • [x] https://github.com/godotengine/godot/issues/42959 (https://github.com/godotengine/godot/pull/43076)
  • [x] https://github.com/godotengine/godot/issues/50382
  • [ ] https://github.com/godotengine/godot/issues/42719#issuecomment-886217688
  • [x] https://github.com/godotengine/godot/issues/60602
  • [ ] https://github.com/godotengine/godot/issues/62712
  • [ ] https://github.com/godotengine/godot/issues/94705
  • [ ] https://github.com/godotengine/godot/issues/97708

For contributors

Even if you're a beginner in C++, you should be able to add error macros. This is why this issue has a junior job label :slightly_smiling_face:

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.

Calinou avatar Oct 11 '20 13:10 Calinou

Add #41493 . I've also made a PR for the same

theoway avatar Oct 11 '20 18:10 theoway

File.eof_reached()` causes infinite while-loop on Android when read/write permissions aren't set #42959

Any idea where the error macro call should be? Is it at https://github.com/godotengine/godot/blob/6c173e2f7ffdb972ec3754b3d78fe51bfbfb4f22/core/bind/core_bind.cpp#L1374 replaced by ERR_FAIL_COND_V_MSG(!f, String(), "File must be opened before use. In case you are on the Android, check if the app has file read-write permission.");. Or should the error be somewhere in Android platform-specific part of codebase?

Anutrix avatar Oct 25 '20 13:10 Anutrix

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

Calinou avatar Oct 25 '20 13:10 Calinou

What's the difference between __ANDROID__ or ANDROID_ENABLED? I'm assuming one of these must be used.

Anutrix avatar Oct 25 '20 14:10 Anutrix

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

Calinou avatar Oct 25 '20 14:10 Calinou

I would just like to point out that the links at the bottom of the error macros page in the master branch docs are dead as of #43385

kyleguarco avatar Nov 13 '20 15:11 kyleguarco

Yes, most references to core/ files in https://docs.godotengine.org/en/latest/development/cpp/index.html will need to be updated.

akien-mga avatar Nov 13 '20 15:11 akien-mga

Godot 3.2.3, Windows 10, GLES 2

image

AaronRecord avatar Mar 07 '21 02:03 AaronRecord

@LightningAA "high-end platform" means GLES3. We intentionally use a generic term as there may be several high-end platforms in the future (such as Metal or Direct3D 12).

That said, "high-end renderer" or "high-end backend" would be a more fitting term here. Also, since 3.2.x won't get any additional renderers, it makes sense to reference GLES3 there instead. I just don't think this will apply to 4.x and later :slightly_smiling_face:

Calinou avatar Mar 07 '21 12:03 Calinou

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

AaronRecord avatar Mar 07 '21 21:03 AaronRecord

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 :slightly_smiling_face:

Calinou avatar Mar 07 '21 22:03 Calinou

@Calinou

JacobianEntrySW: Condition "mAdiag <= realt(0.0)" is true.

I'm getting hundreds of these errors per second. I'm using lots of connected RigidBodys, with (mostly) 6DOA joints. GodotPhysics mode.

I have absolutely no idea what this means. I know its something to do with joints, but no idea what. The message is too abstract to fix the issue. This clogs up memory - after 10 mins my project will crash.

Here is the entire paste from the debugger

E 0:00:00.967 JacobianEntrySW: Condition "mAdiag <= realt(0.0)" is true. <C++ Source> ./servers/physics/joints/jacobianentrysw.h:91 @ JacobianEntrySW()

yankscally avatar Jul 25 '21 15:07 yankscally

Closing as there's not much actionable anymore in this old issue, so it's misleading as a good first issue.

akien-mga avatar Oct 03 '22 14:10 akien-mga

Reopening, so that users can report additional cryptic error messages.

Calinou avatar Jun 13 '24 13:06 Calinou

Going through some recent development screenshots of errors and the like, so I'm not 100% sure what caused this. But this is a good example of errors that do not give enough information to be appropriately tracked down and solved by the average Godot user, without wasting hours debugging and trying to find the potential cause via process of elimination.

image

  1. Upon reading I'm not sure what this error means. Probably a text_edit is trying to set the caret to a position of -1? That'd be my best guess, but that's not actually what it says.
  2. What node? What location? What script tried to set this to begin with? What is the text in the lineedit? Even if I understand that somewhere in my code I'm setting the caret of a lineedit wrong, that doesn't mean I know which of my currently spawned 30 lineedits causes this particular issue!

Godot 3.5, Windows 10

Arecher avatar Jun 13 '24 14:06 Arecher

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

  • Production edit: Addressed by https://github.com/godotengine/godot/pull/95569.

Arecher avatar Jun 13 '24 14:06 Arecher

image

  1. What timer? What's it called, what is it's parent node? What tried to set this invalid Time?
  • Production edit: Addressed by https://github.com/godotengine/godot/pull/95572.

Arecher avatar Jun 13 '24 14:06 Arecher

image

  1. What image (if saved)? Where (script, function) is it being used/created?

Haven't had this one be an issue as often, it's often fairly easy to track down, because you're unlikely to be working with multiple in-progress functions that create images. But it fits in the list nonetheless. If somewhere in your project a random condition appears that makes an image 0px in height, I'd love to know where that came from

Arecher avatar Jun 13 '24 14:06 Arecher

This same error essentially happens for move_child() etc

Specifically this one image

  1. What were we trying to add? To what parent node? What is that parents path? What script/function tried to add this?

Arecher avatar Jun 13 '24 14:06 Arecher

image

  1. What method did we attempt to call? What tried to call it? What node are we trying to call it in?

Arecher avatar Jun 13 '24 14:06 Arecher

image image image

This one is rarely an issue, due to the user made signal name making it fairly easy to track down. But it would still be very nice to know what node/script it is trying to find this signal in. Especially since this error can also show up for default Godot signals, in which case Nonexistent Signal: texture_changed doesn't give you any leads on where this might be going wrong.

  1. What node is this signal being called in? Paths are always great.

The second one saying "that object" really adds to the sadness

  • Production edit: Addressed by https://github.com/godotengine/godot/pull/95579.

Arecher avatar Jun 13 '24 14:06 Arecher

image

  1. What node is this tween being started from?

Arecher avatar Jun 13 '24 14:06 Arecher

image

  1. What function/node called this? What's the name/type of the node that isn't inside the tree?

One of these cases where this could apply to any node in your project, and there is absolutely 0 indication of where to even start looking.

Arecher avatar Jun 13 '24 14:06 Arecher

image

  1. What is the path of the file we're trying to open? What's the directory this file is in?

Usually not an issue that takes long to find/fix, but it should just be part of the error message to help you track down the correct issue faster.

Arecher avatar Jun 13 '24 14:06 Arecher

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.

Arecher avatar Jun 13 '24 14:06 Arecher

Godot 4.2.1

image servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp:777 - Parameter "mesh" is null. is the error that gets continuously thrown in my project. The errors get thrown in one specific scene whenever I open it or when I just switch scene and switch back to this scene, around 90ish of em each time.

I've pinpointed the error to be due to the GridMap nodes I am using, specifically the ones sitting under the NavigationRegion3D node image If I remove some of the nodes the amount of errors gets reduced, and if I delete them all the errors are gone. I have other GridMap nodes outside of the NavigationRegion3D node but they don't cause any problems. Moving the GridMap nodes outside of the NavigationRegion3D node and deleting the latter does not remove the errors, either.

https://github.com/godotengine/godot/assets/38227348/e991219c-68a2-479e-9228-b55261833e4b

The amount of errors seems quite arbitrary, I tried adding 7 new tiles to the scene and it only added 4 more errors upon refresh. Deleting these tiles also causes an error each time, but only if I delete them after refreshing the scene. But it gave an error upon deleting any of them, not just 4 of them.

This is about all the testing I've done, no mesh is missing from the Mesh Library, so I have no leads on what this could mean.

MYNAMEISRADU avatar Jun 13 '24 17:06 MYNAMEISRADU

Does it still happen in 4.2.2?

AThousandShips avatar Jun 14 '24 13:06 AThousandShips

image

  1. I don't even know what this means, or what it relates to.

Arecher avatar Jun 18 '24 19:06 Arecher

image

  1. A nice engine error. No clue where to even start looking on how to solve this one.

Arecher avatar Jun 18 '24 19:06 Arecher