pathwaycom/pathway · error · ValueError

Columns of the argument in Table.update_cells() not present

Error message

Columns of the argument in Table.update_cells() not present in the updated table: {list(names)}.

What it means

Raised by Table.update_cells() when the argument table contains column names that do not exist in the updated table. update_cells overwrites cell values for existing columns only; it cannot introduce new columns, so any extra column in `other` is rejected before type alignment.

Source

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

        ...   | age | owner | pet
        ... 1 | 10  | Alice | 1
        ... 2 | 9   | Bob   | 1
        ... 3 | 8   | Alice | 2
        ... ''')
        >>> t2 = pw.debug.table_from_markdown('''
        ...     age | owner | pet
        ... 1 | 10  | Alice | 30
        ... ''')
        >>> pw.universes.promise_is_subset_of(t2, t1)
        >>> t3 = t1.update_cells(t2)
        >>> pw.debug.compute_and_print(t3, include_id=False)
        age | owner | pet
        8   | Alice | 2
        9   | Bob   | 1
        10  | Alice | 30
        """
        if names := (set(other.keys()) - set(self.keys())):
            raise ValueError(
                f"Columns of the argument in Table.update_cells() not present in the updated table: {list(names)}."
            )

        if self._universe == other._universe:
            warnings.warn(
                "Key sets of self and other in update_cells are the same."
                + " Using with_columns instead of update_cells.",
                stacklevel=_stacklevel + 4,
            )
            return self.with_columns(*(other[name] for name in other))

        schema = {}
        for key in other.keys():
            schema[key] = _types_lca_with_error(
                self.schema._dtypes()[key],
                other.schema._dtypes()[key],
                function_name="an update_cells",
                pointers=False,

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Select only the target columns from the argument: t1.update_cells(t2.select(*t1.keys()))
  2. Or drop the extra columns: t1.update_cells(t2.without('extra_col'))
  3. If the extra columns should exist on both sides, add them to t1 first via with_columns, then update_cells
  4. Guard in code: extra = set(t2.keys()) - set(t1.keys()); if extra: t2 = t2.select(*t1.keys())

Example fix

# before
t3 = t1.update_cells(t2)  # t2 has extra column 'score'

# after
t3 = t1.update_cells(t2.select(*t1.keys()))
Defensive patterns

Strategy: validation

Validate before calling

def update_cells_safe(t1, t2):
    extra = set(t2.keys()) - set(t1.keys())
    if extra:
        t2 = t2.select(*t1.keys())
    return t1.update_cells(t2)

Try / catch

try:
    t3 = t1.update_cells(t2)
except ValueError as e:
    if 'not present in the updated table' in str(e):
        t3 = t1.update_cells(t2.select(*t1.keys()))

Prevention

When it happens

Trigger: t1.update_cells(t2) where set(t2.keys()) - set(t1.keys()) is non-empty, e.g. t2 was produced by with_columns and carries an extra derived column.

Common situations: Feeding a table that went through enrichment/with_columns into update_cells; copying update code between pipelines whose base schemas differ; version changes where a connector added a field.

Related errors


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