[customer analytics] column_configurations LIST returns 500, breaking accounts saved views
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Summary
GET /api/environments/:id/column_configurations — the endpoint backing accounts saved views — returns HTTP 500 in some environments, so saved views fail to load. The most likely cause is that the migration adding the properties JSON field to ColumnConfiguration hasn't been applied in the affected environment (the serializer selects properties, so a missing column raises UndefinedColumn → 500). A secondary suspect is a malformed stored filters/properties value. The fix is to verify/apply the migration and harden the serializer against malformed stored JSON.
Part of #68887.
Confidence: root cause is inferred from code; a server-side traceback for one of these 500s would confirm which cause it is.
Details for coding agents
Root cause (most likely)
Migration 1224_columnconfiguration_properties.py added the properties JSONField to ColumnConfiguration. If it isn't applied in an environment, the LIST query selecting posthog_columnconfiguration.properties fails with a Postgres UndefinedColumn and returns an unhandled 500. To confirm: SELECT properties FROM posthog_columnconfiguration LIMIT 1 in that environment — a "column does not exist" error confirms the missing migration.
Secondary suspect
A stored row whose filters/properties/order_by JSON can't be serialized in to_representation. Current code handles None/{}/lists, so no obvious crash if migrations are current — hence the migration is the stronger hypothesis.
Proposed fix
- Verify and apply the migration in the affected environment(s).
- Defensively guard
to_representationagainst malformed stored JSON so one bad row can't 500 the whole list.
References
posthog/models/column_configuration.py:19(propertiesfield)posthog/migrations/1224_columnconfiguration_properties.py(the migration)posthog/api/column_configuration.py:68-71(to_representation/validate_filters)products/customer_analytics/frontend/components/Accounts/accountsViewsLogic.ts(consumer — saved views)
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 with posthog/migrations/1224_columnconfiguration_properties.py and posthog/models/column_configuration.py, then inspect posthog/api/column_configuration.py:68-71 and confirm the reported database error in the affected environment. Done means the column_configurations LIST endpoint no longer returns 500 with the migration applied, including when stored filters or properties are malformed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python, typescript
- Domain
- api, backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100