Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Handle JSON marshal error in agentic question tool response

rcourtmane197fa3db5c0
diff --git a/internal/ai/chat/agentic_question_tool.go b/internal/ai/chat/agentic_question_tool.go
index ae0ca1c178..cc1fd81a0e 100644
--- a/internal/ai/chat/agentic_question_tool.go
+++ b/internal/ai/chat/agentic_question_tool.go
@@ -99,7 +99,10 @@ func (a *AgenticLoop) executeQuestionTool(ctx context.Context, sessionID string,
"question_id": questionID,
"answers": answers,
}
- out, _ := json.Marshal(payload)
+ out, err := json.Marshal(payload)
+ if err != nil {
+ return fmt.Sprintf("Error: failed to encode answers: %v", err), true
+ }
return string(out), false
case <-ticker.C:
a.mu.Lock()