pathwaycom/pathway · error · ValueError

wrong output universe. No argument of name: {arg}

Error message

wrong output universe. No argument of name: {arg}

What it means

In the pandas UDF adapter, output_universe names which function argument's table defines the output universe: its index becomes the resulting table's universe. When output_universe is a string, _argument_index looks it up in func_spec.arg_names; if the wrapped function has no parameter with that name, the lookup ValueError is re-raised with this message.

Source

Thrown at python/pathway/stdlib/utils/pandas_transformer.py:46

        reduced = tupled_cols.reduce(
            **{f"_{idx}": pw.reducers.sorted_tuple(tupled_cols.all_cols)}
        )
        result.append(reduced)

    def _add_tables(first: pw.Table, *tables: pw.Table) -> pw.Table:
        for table in tables:
            first += table.with_universe_of(first)
        return first

    return _add_tables(*result)


def _argument_index(func_spec: FunctionSpec, arg: str | int | None) -> int | None:
    if isinstance(arg, str):
        try:
            return func_spec.arg_names.index(arg)
        except ValueError:
            raise ValueError(f"wrong output universe. No argument of name: {arg}")
    elif isinstance(arg, int):
        if arg < 0 or arg >= len(func_spec.arg_names):
            raise ValueError("wrong output universe. Index out of range")
    return arg


def _pandas_transformer(
    *inputs: pw.Table,
    func_spec: FunctionSpec,
    output_schema: type[schema.Schema],
    output_universe: str | int | None,
) -> pw.Table:
    output_universe_arg_index = _argument_index(func_spec, output_universe)
    func = func_spec.func

    def process_pandas_output(
        result: pd.DataFrame | pd.Series, pandas_input: list[pd.DataFrame] = []
    ):

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Set output_universe to the exact parameter name of the UDF that should define the output index
  2. Or switch to the positional form output_universe=<index of that argument>
  3. Print inspect.signature(func) / the decorator's function spec to confirm the recognized names

Example fix

# before
@pw.pandas_transformer(output_universe='right')
def f(left: pd.DataFrame, other: pd.DataFrame) -> pd.DataFrame: ...

# after
@pw.pandas_transformer(output_universe='other')
def f(left: pd.DataFrame, other: pd.DataFrame) -> pd.DataFrame: ...
Defensive patterns

Strategy: validation

Validate before calling

import inspect
names = list(inspect.signature(your_udf).parameters)
assert output_universe in names, f'output_universe {output_universe!r} not in UDF args {names}'

Type guard

def output_universe_name_is_valid(func, name: str) -> bool:
    import inspect
    return name in inspect.signature(func).parameters

Prevention

When it happens

Trigger: pw.pandas_transformer-style decorator with output_universe='right' where the wrapped UDF's parameters are (left_df, other_df); a typo in the argument name; renaming the UDF parameters without updating output_universe.

Common situations: Adapting example code where argument names differ from your function's signature; IDE auto-renaming UDF parameters; switching between name-based and index-based output_universe.

Related errors


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