Skip to content

Navigation: Improve error message for unreachable polygon case - #113923

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
VewDev:master
Jun 29, 2026
Merged

Navigation: Improve error message for unreachable polygon case#113923
Repiteo merged 1 commit into
godotengine:masterfrom
VewDev:master

Conversation

@VewDev

@VewDev VewDev commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Change error message per the comments in #113913

Let me know if the message should be changed to anything else to be more descriptive.

Fun fact: The "reachable polygon not found" error message is in line 404 in both files 😆

@VewDev
VewDev requested a review from a team as a code owner December 12, 2025 09:54
Comment thread modules/navigation_2d/2d/nav_mesh_queries_2d.cpp Outdated
@AThousandShips AThousandShips added this to the 4.x milestone Dec 12, 2025
@AThousandShips AThousandShips changed the title fix: error message for unreachable polygon case Navigation: Improve error message for unreachable polygon case Dec 12, 2025

@AThousandShips AThousandShips left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you! Would be good to get an opinion from the navigation team that this is indeed a correct interpretation of the wording, but it should be

@MJacred MJacred left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my understanding, this message would be sent every time an agent reached a point where they (most likely) cannot get any closer.
I reckon the message is sent in order to tell the dev: "Just so you know, your agent cannot get any closer than this. You really should test if your destination is reachable. And if it's not, don't keep asking your agent to go there. Then I won't spam you with more messages."
If navigation optimization is done, these messages would occur rarely.
The reason they cannot get closer might be because the max path search parameters restrict the agent too much. Or some navigation link is not compatible with the agent. Or the region got fractured into islands. Or start and end polygon are in different regions that are not connected at all.

if (traversable_polys.is_empty()) {
// Thus use the further reachable polygon
ERR_BREAK_MSG(is_reachable == false, "It's not expect to not find the most reachable polygons");
ERR_BREAK_MSG(is_reachable == false, "Unlikely to find most reachable polygon, aborting.");

This comment was marked as outdated.

@smix8

smix8 commented May 9, 2026

Copy link
Copy Markdown
Contributor

The legacy naming does not do justice how severe this error case here is.

That code is only reachable after the loop had already a broken case where it runs past the point of exit it should take.

This new error msg is too mild and inaccurate and should not be merged like this.

If we want to rename this msg we really would need something closer to "Printer is on fire" to convey how severe this error is. A project that manages to trigger it has totally messed up navmesh geometry or placement, else it is impossible to reach it and likely their error log is already full from other stuff in that case.

The reason this msg is so archaic is because it is rarely reachable by end users. It is the kind of error that core devs face naturally when they tinker with the actual core code and mess the index or connections up on core changes.

A normal user would need to totally ignore all the connection merge errors in its project to be ever able to cause a case to reach that error so they have far more very important stuff to fix first before they should bother themself about this error here.

The msg for end users should basically be "dont' worry, fix your other error stuff and this will disappear automatically." and for core devs "congratulation, you likely f-ed the index or connection pointers up".

@VewDev

VewDev commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

In response to @smix8

A project that manages to trigger it has totally messed up navmesh geometry or placement

The msg for end users should basically be "dont' worry, fix your other error stuff and this will disappear automatically." and for core devs "congratulation, you likely f-ed the index or connection pointers up".

Would an error message like Invalid navigation index or connection pointers. Check preceding navmesh geometry or placement errors. or Unreachable navigation state encountered. Check preceding navmesh geometry or placement errors. be good?

If I were tinkering with core and got that error without the preceding errors, I would know I broke something. If I were just a "regular" user, I would check the preceding errors.

@VewDev

VewDev commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Updated the message to reflect this.

@VewDev

VewDev commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Should I squash these changes or something? Or will you just do a squash commit?

@VewDev
VewDev requested a review from MJacred June 24, 2026 13:06
@AThousandShips

Copy link
Copy Markdown
Member

Please squash the changes we do not use squash commits, thank you!

@Repiteo Repiteo modified the milestones: 4.x, 4.8 Jun 24, 2026
@VewDev VewDev closed this Jun 28, 2026
@VewDev VewDev reopened this Jun 28, 2026
@VewDev

VewDev commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Done. Ignore the closed/reopened, GitHub apparently didnt like me deleting my commits and making a new squashed one (it was a single line so I thought this would be the easiest way)

@Repiteo
Repiteo merged commit 4cd2d92 into godotengine:master Jun 29, 2026
26 of 27 checks passed
@Repiteo

Repiteo commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Thanks! Congratulations on your first merged contribution! 🎉

BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
Navigation: Improve error message for unreachable polygon case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants