Skip to content

Handle ROUTING_APP error response in onResponseTraceRoute#930

Open
NoctisSentinel wants to merge 3 commits into
meshtastic:masterfrom
pieceofr:fix/traceroute-routing-error-response
Open

Handle ROUTING_APP error response in onResponseTraceRoute#930
NoctisSentinel wants to merge 3 commits into
meshtastic:masterfrom
pieceofr:fix/traceroute-routing-error-response

Conversation

@NoctisSentinel
Copy link
Copy Markdown

Summary

  • onResponseTraceRoute did not handle ROUTING_APP error packets, causing it to attempt parsing them as RouteDiscovery payloads, resulting in a crash or silent failure followed by a spurious timeout message
  • Added a check at the start of onResponseTraceRoute that prints the specific errorReason and exits the wait loop cleanly
  • Unlike onResponseTelemetry and onResponseWaypoint which show a hardcoded firmware version message, traceroute shows the actual error reason since it is a diagnostic tool where knowing the specific failure is more valuable

Test plan

  • Traceroute to unreachable node shows Traceroute failed: MAX_RETRANSMIT (or relevant error) without a spurious Timed out waiting for traceroute message
  • Successful traceroute still displays route correctly

🤖 Generated with Claude Code

Previously, receiving a ROUTING_APP packet in response to a traceroute
would cause the function to attempt parsing it as a RouteDiscovery
payload, resulting in a crash or silent failure followed by a timeout.

This mirrors the error handling already present in onResponseTelemetry
and onResponseWaypoint, but displays the specific errorReason instead
of a hardcoded firmware version message, since traceroute is a
diagnostic tool where the exact failure reason is more valuable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 3, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Meshtastic’s Python interface traceroute response handling to properly deal with ROUTING_APP error responses, avoiding mis-parsing routing errors as RouteDiscovery payloads and preventing misleading timeout behavior.

Changes:

  • Added an early check in onResponseTraceRoute for ROUTING_APP packets to detect traceroute failures.
  • Prints the specific routing.errorReason on traceroute failure and terminates the traceroute wait cleanly by setting receivedTraceRoute.

Comment on lines +690 to +694
if p["decoded"]["portnum"] == "ROUTING_APP":
error = p["decoded"]["routing"]["errorReason"]
print(f"Traceroute failed: {error}")
self._acknowledgment.receivedTraceRoute = True
return
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@NoctisSentinel
Copy link
Copy Markdown
Author

Thanks for the review! Added a unit test in the latest commit that feeds a ROUTING_APP response with MAX_RETRANSMIT into onResponseTraceRoute and asserts both that receivedTraceRoute is set to True and the error message is printed.

ROUTING_APP with errorReason NONE is an ACK (success), not an error.
Only print failure message for non-NONE error reasons.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants