From a4dd7210d8a4cc2829d1dfeba142db35eeb1b0a2 Mon Sep 17 00:00:00 2001 From: mayor Date: Fri, 6 Feb 2026 10:36:37 -0600 Subject: [PATCH] Improve error logging for SNMP result validation failures Add detailed error logging to show specific validation error type and message when SNMP results fail validation. Also handle base64 decode failures separately. This will help diagnose validation issues introduced by recent strict protobuf validation changes (commit 8044a6d1). --- lib/towerops_web/channels/agent_channel.ex | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/towerops_web/channels/agent_channel.ex b/lib/towerops_web/channels/agent_channel.ex index 0a3e5cbc..57c7d509 100644 --- a/lib/towerops_web/channels/agent_channel.ex +++ b/lib/towerops_web/channels/agent_channel.ex @@ -254,10 +254,19 @@ defmodule ToweropsWeb.AgentChannel do {:noreply, socket} else {:error, {type, message}} -> - Logger.error("Invalid SNMP result from agent", + Logger.error("Invalid SNMP result from agent: #{type} - #{message}", agent_token_id: socket.assigns.agent_token_id, error_type: type, - error_message: message + error_message: message, + binary_size: byte_size(binary_b64) + ) + + {:noreply, socket} + + {:error, :base64_decode_failed} -> + Logger.error("Failed to decode SNMP result (invalid base64)", + agent_token_id: socket.assigns.agent_token_id, + binary_size: byte_size(binary_b64) ) {:noreply, socket}