Bug: Deleting the only series in an Insight causes a server error and breaks rendering
Nobody has claimed this yet.
- 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
- Create a new Insight (e.g. Trends)
- Add a single series (e.g. “Count of events”)
- Save the Insight
- Edit the Insight
- Delete the only remaining series
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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