Summary
A funnel that mixes a regular events series with a data-warehouse series fails the whole query with ClickHouse Code: 386 ... no supertype for types UUID, String (NO_COMMON_TYPE).
Surfaced from system.query_log analysis of failing product-analytics insight queries — ~46 occurrences / ~5 teams over 7 days. Tracked on the Product analytics — insight query failures dashboard.
Root cause
The funnel UNION ALLs its series. The two series resolve aggregation_target to incompatible types:
-- Events series: person aggregation
if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target -- UUID
UNION ALL
-- Data-warehouse series
e.user_id AS aggregation_target -- String
UNION ALL requires matching column types across branches. The events series produces a UUID (person_id); the data-warehouse series produces the warehouse user_id column (String). No common type → the query fails.
Relevant code: posthog/hogql_queries/insights/funnels/funnel_event_query.py — _aggregation_target_expr() (events path, resolves to person_id UUID) and the data-warehouse path (parse_expr(table_entity.aggregation_target_field), a String).
Proposed fix
When a funnel mixes a data-warehouse series with an events series, coerce every series' aggregation_target to a common type (toString(...)) so the UNION ALL is well-typed.
- For a mixed funnel the downstream actors query already has to cope with non-UUID actor ids (the data-warehouse series produces them), so
toString is consistent there.
- A pure-events funnel must stay
UUID — coercing unconditionally would break the persons-modal lookup (person.id = actor_id).
So the fix needs "mixed funnel" detection plus parity testing of the actors/persons drill-in. It deserves its own focused PR with funnel-area review rather than a blanket change.
Repro
A FunnelsQuery with one EventsNode step and one DataWarehouseNode step where the warehouse table's id/user column is a string.
🤖 Generated with Claude Code
Summary
A funnel that mixes a regular events series with a data-warehouse series fails the whole query with ClickHouse
Code: 386 ... no supertype for types UUID, String(NO_COMMON_TYPE).Surfaced from
system.query_loganalysis of failing product-analytics insight queries — ~46 occurrences / ~5 teams over 7 days. Tracked on the Product analytics — insight query failures dashboard.Root cause
The funnel
UNION ALLs its series. The two series resolveaggregation_targetto incompatible types:UNION ALLrequires matching column types across branches. The events series produces aUUID(person_id); the data-warehouse series produces the warehouseuser_idcolumn (String). No common type → the query fails.Relevant code:
posthog/hogql_queries/insights/funnels/funnel_event_query.py—_aggregation_target_expr()(events path, resolves toperson_idUUID) and the data-warehouse path (parse_expr(table_entity.aggregation_target_field), a String).Proposed fix
When a funnel mixes a data-warehouse series with an events series, coerce every series'
aggregation_targetto a common type (toString(...)) so theUNION ALLis well-typed.toStringis consistent there.UUID— coercing unconditionally would break the persons-modal lookup (person.id = actor_id).So the fix needs "mixed funnel" detection plus parity testing of the actors/persons drill-in. It deserves its own focused PR with funnel-area review rather than a blanket change.
Repro
A
FunnelsQuerywith oneEventsNodestep and oneDataWarehouseNodestep where the warehouse table's id/user column is a string.🤖 Generated with Claude Code