From 0413d00825fea5e3aa2230278852bb2292bbb774 Mon Sep 17 00:00:00 2001 From: Nox Date: Wed, 3 Jun 2026 22:50:56 +0800 Subject: [PATCH] Handle ROUTING_APP error response in onResponseTraceRoute 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 --- meshtastic/mesh_interface.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 5dfb393..d8083c6 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -687,6 +687,12 @@ class MeshInterface: # pylint: disable=R0902 def onResponseTraceRoute(self, p: dict): """on response for trace route""" + if p["decoded"]["portnum"] == "ROUTING_APP": + error = p["decoded"]["routing"]["errorReason"] + print(f"Traceroute failed: {error}") + self._acknowledgment.receivedTraceRoute = True + return + UNK_SNR = -128 # Value representing unknown SNR routeDiscovery = mesh_pb2.RouteDiscovery()