PostHog / PostHog/posthog

"There was a problem completing this query" on Dashboards for session based breakdown insights (Self-Hosted)

Open
#22,802 0 comments 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

We are using the self-hosted docker image for Posthog version Git SHA: 728d2c1c46

It seems like there is a bug with session related insights in Dashboards.
If we create a trends insight for Page views (Unique sessions) and add a breakdown by "Entry URL", the insight work well but as soon as you add it to the dashboard the widget says: "There was a problem completing this query" and if we click on "Open in query debugger" the query also works. The insight also works in Notebooks so it only doesn't work in dashboards.

The same issue occurs with any other session based breakdown. We tested "Entry pathname", "Entry URL", "Session Duration", etc. for different types of event "Page views", "All events", custom events.

How to reproduce

  1. Create a trend insight.
  2. Select "Page views" by "Unique Sessions"
  3. Add breakdown by "Entry URL"
  4. Save insight and add to dashboard.
  5. Insight won't work in dashboard.

Additional context

Here is the raw query that is working in insights and notebooks but NOT in dashboards:

{
  "kind": "TrendsQuery",
  "filterTestAccounts": true,
  "dateRange": {
    "date_to": null,
    "date_from": null
  },
  "series": [
    {
      "kind": "EventsNode",
      "event": "$pageview",
      "name": "$pageview",
      "math": "unique_session"
    }
  ],
  "interval": "day",
  "breakdownFilter": {
    "breakdown_type": "session",
    "breakdown": "$entry_current_url"
  },
  "trendsFilter": {
    "display": "ActionsLineGraph"
  }
}
Debug info
- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]
- [X] PostHog Hobby self-hosted with `docker compose`, version/commit: 728d2c1c46
- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]

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 with the TrendsQuery shown in the issue and compare how it is executed in dashboards versus insights, notebooks, and the query debugger. Reproduce the session breakdown with Unique Sessions and Entry URL, then trace the dashboard widget path; done means the same query renders successfully in a dashboard and has regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
analytics, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.