pathwaycom/pathway · error · TypeError

Input table has a column {column!r} but it is not present on

Error message

Input table has a column {column!r} but it is not present on the argument list of the invoke method.

What it means

On construction, AsyncTransformer binds the input table's column names as keyword arguments against the signature of the user's invoke() method. If inspect's sig.bind fails with 'got an unexpected keyword argument', the transformer rewrites it into this TypeError naming the offending column: the table has a column the invoke() method does not accept.

Source

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

        instance_dtype = eval_type(input_table[_INSTANCE_COLUMN])
        if not dt.is_hashable_in_python(instance_dtype):
            raise ValueError(
                f"You can't use a column of type {instance_dtype} as instance in"
                + " AsyncTransformer because it is unhashable."
            )

        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,

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Add the missing parameter to invoke(), e.g. def invoke(self, q: str, metadata: str = None), if the column is useful
  2. Otherwise project the table down before construction: pw.AsyncTransformer(input_table[['q', ...]], ...)
  3. Give the extra invoke parameters default values so future extra columns bind cleanly

Example fix

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

# after
out = E(t.select('q'))  # or add `metadata: str = None` to invoke()
Defensive patterns

Strategy: validation

Validate before calling

import inspect
params = set(inspect.signature(YourTransformer.invoke).parameters) - {'self'}
missing_on_invoke = set(input_table.schema.column_names()) - params
assert not missing_on_invoke, f'columns not accepted by invoke(): {missing_on_invoke}'

Type guard

def invoke_accepts_all_columns(cls: type, table: pw.Table) -> bool:
    import inspect
    params = set(inspect.signature(cls.invoke).parameters) - {'self'}
    return set(table.schema.column_names()) <= params

Prevention

When it happens

Trigger: pw.AsyncTransformer(table, ...) where table has columns (q, metadata) but invoke(self, q) is defined; adding a helper column via with_columns before passing the table; a connector schema that includes extra fields not consumed by invoke().

Common situations: Adding an instance/key column to the table with with_columns before constructing the transformer; REST/Kafka connector schemas evolving to include new fields while invoke() stays unchanged; copy-pasting an AsyncTransformer subclass onto a new table with a wider schema.

Related errors


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