pathwaycom/pathway · error · ValueError

Table.windowby() received extra kwargs. You probably want to

Error message

Table.windowby() received extra kwargs.
You probably want to use Table.windowby(...).reduce(**kwargs) to compute output columns.

What it means

Table.windowby() takes a fixed keyword set (window, behavior, instance) plus one time expression; it does not compute output columns. Any leftover kwargs are assumed to be intended aggregations, and this ValueError redirects them to the chained .reduce(**kwargs) call. It is the windowed analogue of the groupby extra-kwargs guard.

Source

Thrown at python/pathway/internals/arg_handlers.py:61

        "id": id,
        "sort_by": sort_by,
        "_filter_out_results_of_forgetting": _filter_out_results_of_forgetting,
        "instance": instance,
        "_skip_errors": _skip_errors,
        "_is_window": _is_window,
    }


def windowby_handler(
    self, time_expr, *args, window, behavior=None, instance=None, **kwargs
):
    if args:
        raise ValueError(
            "Table.windowby() received extra args.\n"
            + "It handles grouping only by a single column."
        )
    if kwargs:
        raise ValueError(
            "Table.windowby() received extra kwargs.\n"
            + "You probably want to use Table.windowby(...).reduce(**kwargs) to compute output columns."
        )
    return (self, time_expr), {
        "window": window,
        "behavior": behavior,
        "instance": instance,
    }


def join_kwargs_handler(*, allow_how: bool, allow_id: bool):
    def handler(self, other, *on, **kwargs):
        processed_kwargs = {}
        if "how" in kwargs:
            how = kwargs.pop("how")
            processed_kwargs["how"] = how
            if not allow_how:
                raise ValueError(

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Move aggregations into reduce: t.windowby(t.time, window=w).reduce(sum=pw.reducers.sum(t.value)).
  2. Verify only window/behavior/instance kwargs remain on windowby.
  3. Use pw.temporal windows plus reducers.id for passthrough columns in reduce.

Example fix

# before
t.windowby(t.time, window=pw.temporal.tumbling(duration=timedelta(minutes=5)), total=pw.reducers.sum(t.v))

# after
t.windowby(t.time, window=pw.temporal.tumbling(duration=timedelta(minutes=5))).reduce(
    total=pw.reducers.sum(t.v)
)
Defensive patterns

Strategy: validation

Validate before calling

allowed = {"window", "behavior", "instance"}
unknown = set(kwargs) - allowed
if unknown:
    raise TypeError(f"pass {unknown} to .reduce() chained after windowby")

Prevention

When it happens

Trigger: t.windowby(t.time, window=w, sum=pw.reducers.sum(t.value)); passing how= or axis= style options carried over from pandas resample/rolling APIs.

Common situations: Converting pandas df.resample('1min').sum() into one Pathway call; writing a long chained expression and accidentally putting reduce arguments one pair of parentheses too early.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/417119f9180b9d2b. Report an issue: GitHub.