pathwaycom/pathway · error · TypeError
Pathway does not support using reducer {self.name} on column
Error message
Pathway does not support using reducer {self.name} on column of type {arg_type}.
What it means
Tuple-producing reducers such as pathway.reducers.tuple (and ndarray variants) build a dt.List of the argument type, which only makes sense when the column is float-like, array-like, or tuple-like. In TupleConvertibleToNDArrayWrappingReducer.return_type, any other dtype (str, bool, Pointer, json...) fails the dtype_issubclass check against FLOAT/ANY_ARRAY/ANY_TUPLE and raises this TypeError.
Source
Thrown at python/pathway/internals/reducers.py:234
if context.sort_by is not None:
return (context.sort_by.to_column_expression(),)
else:
return ()
class TupleConvertibleToNDArrayWrappingReducer(TupleWrappingReducer):
def return_type(
self, arg_types: builtins.list[dt.DType], id_type: dt.DType
) -> dt.DType:
arg_type = arg_types[0]
if self._skip_nones:
arg_type = dt.unoptionalize(arg_type)
if builtins.any(
dt.dtype_issubclass(arg_type, dtype)
for dtype in [dt.FLOAT, dt.ANY_ARRAY, dt.ANY_TUPLE]
):
return dt.List(arg_type)
raise TypeError(
f"Pathway does not support using reducer {self.name}"
+ f" on column of type {arg_type}.\n"
)
class StatefulManyReducer(Reducer):
name = "stateful_many"
combine_many: api.CombineMany
def __init__(self, combine_many: api.CombineMany):
self.combine_many = combine_many
def return_type(self, arg_types: list[dt.DType], id_type: dt.DType) -> dt.DType:
return dt.ANY
def engine_reducer(self, arg_types: list[dt.DType]) -> api.Reducer:
return api.Reducer.stateful_many(self.combine_many)
View on GitHub (pinned to fa2f74a464)
Solutions
- Verify the column dtype is float/int/array/tuple before using these reducers; cast if numeric-like data arrived as str.
- For collecting arbitrary values (including strings), write a custom reducer with pw.custom_reducers.red_state_many or use a different aggregation approach.
- If the column is Optional[numeric] and _skip_nones semantics matter, ensure the underlying type after unoptionalize is numeric/array/tuple.
Example fix
# before
agg = t.groupby(t.key).reduce(names=pw.reducers.tuple(t.name)) # name: str
# after
collect_names = pw.custom_reducers.red_state_many(
lambda state, name: (state or []) + [name]
)
agg = t.groupby(t.key).reduce(names=collect_names(t.name)) Defensive patterns
Strategy: validation
Validate before calling
from pathway.internals import dtype as dt
def column_accepts_tuple_reducer(dtype) -> bool:
return any(
dt.dtype_issubclass(dtype, d) for d in (dt.FLOAT, dt.ANY_ARRAY, dt.ANY_TUPLE)
) Prevention
- Reserve pw.reducers.tuple for numeric/array/tuple columns; use custom reducers for strings.
- Un-Optional columns (skip_nones) only when the payload type itself is supported.
When it happens
Trigger: table.reduce(vals=pw.reducers.tuple(pw.this.name)) where name is a str column; or the numpy-oriented reducers (np.values etc.) applied to non-numeric columns. _skip_nones transparently unoptionalizes Optional[...] first, so Optional[str] also fails.
Common situations: Collecting string values per group with pw.reducers.tuple instead of a dedicated string aggregation; feeding json or pointer columns into tuple/np-style reducers.
Related errors
- Pathway does not support using reducer {self} on column of t
- Pathway does not support using binary operator {expression._
- Incompatible types in for a binary operator. The types are:
- {role} {col._name!r} must be of type str, got {col._column.d
- Cannot flatten column of type {dtype}.
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/24ae6b056e54bd15.
Report an issue: GitHub.