pathwaycom/pathway · error · TypeError

Column {arg_name!r} is present on the argument list of the i

Error message

Column {arg_name!r} is present on the argument list of the invoke method but it is not present in the input_table.

What it means

The mirror case of the unexpected-column error: when binding the input table's columns against invoke()'s signature fails with 'missing a required argument', AsyncTransformer raises this TypeError. It means invoke() declares a positional-or-keyword parameter (no default) whose name is not a column of the input table, so the transformer has no value to pass for it.

Source

Thrown at python/pathway/stdlib/utils/async_transformer.py:467

        self._input_table = input_table

    def _check_signature_matches_schema(
        self, sig: inspect.Signature, schema: type[Schema]
    ) -> None:
        try:
            sig.bind(**schema.columns())
        except TypeError as e:
            msg = str(e)
            if match := re.match("got an unexpected keyword argument '(.+)'", msg):
                column = match[1]
                raise TypeError(
                    f"Input table has a column {column!r} but it is not present"
                    + " on the argument list of the invoke method."
                )
            elif match := re.match("missing a required argument: '(.+)'", msg):
                arg_name = match[1]
                raise TypeError(
                    f"Column {arg_name!r} is present on the argument list of the invoke"
                    + " method but it is not present in the input_table."
                )
            raise e

    def __init_subclass__(cls, /, output_schema: type[pw.Schema], **kwargs):
        super().__init_subclass__(output_schema, **kwargs)

    def with_options(
        self,
        capacity: int | None = None,
        timeout: float | None = None,
        retry_strategy: udfs.AsyncRetryStrategy | None = None,
        cache_strategy: udfs.CacheStrategy | None = None,
    ) -> AsyncTransformer:
        """
        Sets async options.

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Rename the parameter to exactly match the existing column name, or rename the table column to the parameter name
  2. Add the missing column to the table: input_table.with_columns(context=...) before construction
  3. Give the parameter a default value if it is optional; defaulted parameters do not fail sig.bind

Example fix

# before
class E(pw.AsyncTransformer, output_schema=S):
    def invoke(self, query: str) -> dict: ...
out = E(t)  # t has column 'q', not 'query'

# after
t = t.rename_columns(query='q')
out = E(t)
Defensive patterns

Strategy: validation

Validate before calling

import inspect
params = set(inspect.signature(YourTransformer.invoke).parameters) - {'self'}
cols = set(input_table.schema.column_names())
required = {p for p in params if inspect.signature(YourTransformer.invoke).parameters[p].default is inspect.Parameter.empty}
assert required <= cols, f'invoke() params missing from table: {required - cols}'

Type guard

def all_required_params_have_columns(cls: type, table: pw.Table) -> bool:
    import inspect
    sig = inspect.signature(cls.invoke)
    req = {n for n, p in sig.parameters.items() if n != 'self' and p.default is inspect.Parameter.empty}
    return req <= set(table.schema.column_names())

Prevention

When it happens

Trigger: invoke(self, q: str, context: str) is defined but the input table only has column q; renaming a table column so it no longer matches the parameter name; passing a projected/selected subset of columns that drops one the method needs.

Common situations: Renaming columns with rename() or select aliasing after the transformer was written; connector schema change dropping a field; parameter name typo (param `query` vs column `q`).

Related errors


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