Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(aio): guard against null summarization response in summary view (#71085)

Radu Raicead6687829a241
diff --git a/products/ai_observability/frontend/summary-view/summaryViewLogic.ts b/products/ai_observability/frontend/summary-view/summaryViewLogic.ts
index 6c96ac43dac5..1f5bdddffce2 100644
--- a/products/ai_observability/frontend/summary-view/summaryViewLogic.ts
+++ b/products/ai_observability/frontend/summary-view/summaryViewLogic.ts
@@ -147,6 +147,12 @@ export const summaryViewLogic = kea<summaryViewLogicType>([
// nosemgrep: prefer-codegen-api
const data = await api.create(`api/environments/${teamId}/llm_analytics/summarization/`, payload)
+ // The endpoint can resolve to an empty body (e.g. no summary available yet),
+ // so guard before reading fields to avoid a null dereference.
+ if (!data || !data.summary) {
+ throw new Error('No summary available for this trace yet')
+ }
+
return {
summary: data.summary,
text_repr: data.text_repr,