pathwaycom/pathway · error · ValueError

In select() all positional arguments have to be a ColumnRefe

Error message

In select() all positional arguments have to be a ColumnReference.

What it means

Table.select()'s argument preprocessor found a positional argument that is not a ColumnReference and not a string — e.g. an integer, list, or arbitrary expression object. select() positionals must be existing column references; all computed values must be supplied as named keyword arguments.

Source

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

                raise ValueError(
                    f"Expected a ColumnReference, found a string. Did you mean this.{arg} instead of {repr(arg)}?"
                )
            else:
                raise ValueError(
                    "In reduce() all positional arguments have to be a ColumnReference."
                )
    return (self, *args), kwargs


def select_args_handler(self, *args, **kwargs):
    for arg in args:
        if not isinstance(arg, expr.ColumnReference):
            if isinstance(arg, str):
                raise ValueError(
                    f"Expected a ColumnReference, found a string. Did you mean this.{arg} instead of {repr(arg)}?"
                )
            else:
                raise ValueError(
                    "In select() all positional arguments have to be a ColumnReference."
                )
    return (self, *args), kwargs

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Unpack lists: table.select(*cols) instead of table.select(cols).
  2. Name computed expressions: table.select(total=t.price + 1).
  3. Remove literal/constant positionals; constants belong in kwargs (e.g. one=1).

Example fix

# before
t.select([t.a, t.b])
t.select(t.price + 1)

# after
t.select(*[t.a, t.b])
t.select(total=t.price + 1)
Defensive patterns

Strategy: type-guard

Validate before calling

import pathway.internals.expression as expr
assert all(isinstance(a, expr.ColumnReference) for a in args), 'select() positionals must be ColumnReference; unpack lists and name computed columns'

Type guard

import pathway.internals.expression as expr

def select_positionals_ok(args) -> bool:
    return all(isinstance(a, expr.ColumnReference) for a in args)

Prevention

When it happens

Trigger: Calling table.select(t.price + 1) positionally, table.select(1), or table.select([t.a, t.b]) (a list instead of unpacked references).

Common situations: Passing a list of columns collected programmatically without unpacking with *; forgetting that expressions in select must be named kwargs (col=t.price + 1).

Related errors


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