PostHog / PostHog/posthog

Bug: Deleting the only series in an Insight causes a server error and breaks rendering

Open
#44,809 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
7h 27m
Merged PRs (30d)
222

Description

Bug Description

It’s possible to delete the only remaining data series in an Insight (e.g. a single “count of events” series). After doing so, the Insight no longer renders and instead shows a server error.

This leaves the Insight in an invalid state. The UI should either prevent deleting the final series or render a safe empty state prompting the user to add data.

Observed error:
TypeError: Cannot read properties of undefined (reading 'math_group_type_index')

How to reproduce

  1. Create a new Insight (e.g. Trends)
  2. Add a single series (e.g. “Count of events”)
  3. Save the Insight
  4. Edit the Insight
  5. Delete the only remaining series
  6. The Insight fails to render and shows a server error

Additional context

From: https://posthoghelp.zendesk.com/agent/tickets/46625 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/49589)

Debug info
Kind: bug

Target area: analytics

Report event: http://go/ticketByUUID/3dfbf7b2-661c-4e26-ba09-b39204400645

Session: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/019ba1fe-e34e-79c2-841d-51930a7fc12a?t=105

Exceptions: https://us.posthog.com/project/2/error_tracking?filterGroup=%7B%22type%22%3A%22AND%22%2C%22values%22%3A%5B%7B%22type%22%3A%22AND%22%2C%22values%22%3A%5B%7B%22key%22%3A%22%24session_id%22%2C%22value%22%3A%5B%22019ba1fe-e34e-79c2-841d-51930a7fc12a%22%5D%2C%22operator%22%3A%22exact%22%2C%22type%22%3A%22event%22%7D%2C%7B%22type%22%3A%22hogql%22%2C%22key%22%3A%22uuid%20%3D%20'019ba1ff-cced-7ba4-b43d-cdaae8483b0b'%22%2C%22value%22%3Anull%7D%5D%7D%5D%7D

Location: https://eu.posthog.com/project/95192/insights/ufBqU3z3/edit

Persons-on-events mode for project: person_id_override_properties_on_events

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the deletion flow in the Insight editor described in steps 1–6, then trace the rendering path that fails on math_group_type_index. Done means deleting the final series no longer produces a server error: the UI either prevents the deletion or renders an empty state that prompts the user to add data.

Written by the indexing model from the issue text.

Assessment

Domain
analytics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.