pathwaycom/pathway · error · ValueError

Received `how` argument but was not expecting any. Consider…

Error message

Received `how` argument but was not expecting any.
Consider using a generic join method that handles `how` to decide on a type of a join to be used.

What it means

Pathway splits join APIs into specific methods (join, join_left, join_right, join_outer, join_any, ...) that do not take a 'how' parameter, and generic methods (join_by / the generic entry points) that do. This handler runs with allow_how=False, so passing how=... to a specific join method raises this ValueError pointing you to the generic method. The check happens in the shared kwargs handler used by Table join methods.

Solutions

  1. Drop the how kwarg from the specific method: t.join_left(t2, t1.k == t2.k).
  2. Or switch to the generic form that accepts how: t.join(t2, t1.k == t2.k, how=pw.JoinMode.LEFT) via the generic entry point.
  3. Pick the method matching the intended mode: join_inner/join_left/join_right/join_outer.

Example fix

# before
t1.join_left(t2, t1.k == t2.k, how="left")

# after
t1.join_left(t2, t1.k == t2.k)
Defensive patterns

Strategy: validation

Validate before calling

def join_left_checked(t1, t2, *on, **kwargs):
    if "how" in kwargs:
        raise TypeError("join_left does not accept how; the method already fixes the mode")
    return t1.join_left(t2, *on, **kwargs)

Prevention

When it happens

Trigger: t1.join_left(t2, t1.k == t2.k, how='left'); t1.join_inner(t2, how=pw.JoinMode.LEFT); any specific-arity join call that includes how.

Common situations: Copy-pasting from generic join examples into specific methods; pandas/sql habits where every join takes how=; refactoring from join(...how=...) to join_left and leaving the kwarg behind.

Related errors


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

Appendix: source

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

        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(
                    "Received `how` argument but was not expecting any.\n"
                    + "Consider using a generic join method that handles `how` "
                    + "to decide on a type of a join to be used."
                )
            elif isinstance(how, JoinMode):
                pass
            elif isinstance(how, str):
                raise ValueError(
                    "Received `how` argument of join that is a string.\n"
                    + "You probably want to use one of "
                    + "JoinMode.INNER, JoinMode.LEFT, JoinMode.RIGHT or JoinMode.OUTER values."
                )
            else:
                raise ValueError(
                    "How argument of join should be one of "
                    + "JoinMode.INNER, JoinMode.LEFT, JoinMode.RIGHT or JoinMode.OUTER values."
                )

View on GitHub (pinned to fa2f74a464)