pathwaycom/pathway · error · ValueError

How argument of join should be one of JoinMode.INNER, JoinMo

Error message

How argument of join should be one of JoinMode.INNER, JoinMode.LEFT, JoinMode.RIGHT or JoinMode.OUTER values.

What it means

The 'how' argument of generic joins must be a JoinMode enum value. This branch catches objects that are neither JoinMode nor str — e.g. an int, a lambda, None, or a custom mode object. It complements the string check: strings get a dedicated hint, everything else gets this generic ValueError.

Source

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

        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."
                )

        if "id" in kwargs:
            id = kwargs.pop("id")
            processed_kwargs["id"] = id
            if not allow_id:
                raise ValueError(
                    "Received `id` argument but was not expecting any.\n"
                    + "Not every join type supports `id` argument."
                )
            elif id is None:
                pass
            elif isinstance(id, str):
                raise ValueError(
                    "Received `id` argument of join that is a string.\n"
                    + f"Did you mean <table>.{id}"

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Replace the value with a JoinMode member: how=pw.JoinMode.INNER/LEFT/RIGHT/OUTER.
  2. If the mode comes from external data, validate and map it to JoinMode before the join call.
  3. Prefer the dedicated join_* methods to avoid passing how entirely.

Example fix

# before
mode = 0  # meant 'inner'
t1.join(t2, t1.k == t2.k, how=mode)

# after
mode = {0: pw.JoinMode.INNER, 1: pw.JoinMode.LEFT}[code]
t1.join(t2, t1.k == t2.k, how=mode)
Defensive patterns

Strategy: type-guard

Validate before calling

import pathway as pw

assert isinstance(how, pw.JoinMode), f"how must be a pw.JoinMode, got {type(how).__name__}"
t1.join(t2, *on, how=how)

Type guard

import pathway as pw

def is_join_mode(v) -> bool:
    return isinstance(v, pw.JoinMode)

Prevention

When it happens

Trigger: how=0 or how=1 (indexing into a mental list of modes); how=None passed explicitly; how='left'.lower() style chained objects; passing a pandas join type constant.

Common situations: Porting numeric join-type codes from another framework; partially-initialized variables passed as how; refactors where how was computed but the fallback became None.

Related errors


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