pathwaycom/pathway · error · ValueError

Table.update_types() argument name has to be an existing tab

Error message

Table.update_types() argument name has to be an existing table column name.

What it means

Raised by Table.update_types() when a kwarg names a column that does not exist in the table. update_types only changes declared type hints on existing columns (it has no runtime effect), so unknown names are rejected before with_types is applied.

Source

Thrown at python/pathway/internals/table.py:2237

            )
        context = clmn.SetSchemaContext(
            _id_column=self._id_column,
            _new_properties={
                self[name]._to_internal(): schema.column_properties(name)
                for name in self.column_names()
            },
            _id_column_props=schema.__universe_properties__,
        )
        return self._table_with_context(context)

    @trace_user_frame
    @check_arg_types
    def update_types(self, **kwargs: Any) -> Table:
        """Updates types in schema. Has no effect on the runtime."""

        for name in kwargs.keys():
            if name not in self.keys():
                raise ValueError(
                    "Table.update_types() argument name has to be an existing table column name."
                )
        new_schema = self.schema.with_types(**kwargs)
        for name in kwargs.keys():
            left = new_schema._dtypes()[name]
            right = self.schema._dtypes()[name]
            if not (
                dt.dtype_issubclass(left, right) or dt.dtype_issubclass(right, left)
            ):
                raise TypeError(
                    f"Cannot change type from {right} to {left}.\n"
                    + "Table.update_types() should be used only for type narrowing or type extending."
                )
        return self._with_schema(new_schema)

    @trace_user_frame
    @check_arg_types
    def update_id_type(self, id_type, *, id_append_only: bool | None = None) -> Table:

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Check names: print(t.column_names()) and fix the kwarg key
  2. If you meant to add a new column, use with_columns instead
  3. If the column was renamed upstream, update the kwarg to the new name
  4. If you meant to cast values (not hints), use cast_to_types on an existing column

Example fix

# before
t2 = t.update_types(ages=int)  # column is 'age'

# after
t2 = t.update_types(age=int)
Defensive patterns

Strategy: validation

Validate before calling

def update_types_safe(t, **kwargs):
    unknown = set(kwargs) - set(t.keys())
    assert not unknown, f'unknown columns: {unknown}'
    return t.update_types(**kwargs)

Try / catch

try:
    t2 = t.update_types(**hints)
except ValueError as e:
    if 'existing table column name' in str(e):
        hints = {k: v for k, v in hints.items() if k in t.keys()}
        t2 = t.update_types(**hints)

Prevention

When it happens

Trigger: t.update_types(missing_col=int) where 'missing_col' is not in t.keys(); typos; renaming earlier in the chain; schema drift between versions.

Common situations: Copy-pasting update_types calls between pipelines; connector schema changed so the column no longer exists; using update_types where with_columns (to add a column) was intended.

Related errors


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