pathwaycom/pathway · error · ValueError
Universe of the argument of Table.update_cells() needs to be
Error message
Universe of the argument of Table.update_cells() needs to be a subset of the universe of the updated table. Consider using Table.promise_is_subset_of() to assert this. (However, untrue assertion might result in runtime errors.)
What it means
Raised by Table._update_cells() when other's universe is not provably a subset of self's universe. update_cells writes values onto existing rows of self, so every row id in `other` must exist in self; otherwise some updates would target non-existent rows. Pathway requires an explicit assertion if the solver cannot prove the subset relation.
Source
Thrown at python/pathway/internals/table.py:1761
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,
)
return Table._update_cells(
self.cast_to_types(**schema), other.cast_to_types(**schema)
)
@trace_user_frame
@contextualized_operator
@check_arg_types
def _update_cells(self, other: Table) -> Table:
if not other._universe.is_subset_of(self._universe):
raise ValueError(
"Universe of the argument of Table.update_cells() needs to be "
+ "a subset of the universe of the updated table.\n"
+ "Consider using Table.promise_is_subset_of() to assert this.\n"
+ "(However, untrue assertion might result in runtime errors.)"
)
context = clmn.UpdateCellsContext(
left=self._id_column,
right=other._id_column,
updates={name: other._columns[name] for name in other.keys()},
)
return self._table_with_context(context)
@trace_user_frame
@check_arg_types
def update_rows(self, other: Table[TSchema]) -> Table[TSchema]:
"""Updates rows of `self`, breaking ties in favor for the rows in `other`.
Semantics:View on GitHub (pinned to fa2f74a464)
Solutions
- If the subset relation genuinely holds, assert it: pw.universes.promise_is_subset_of(t2, t1) before calling t1.update_cells(t2)
- Otherwise restrict the argument: t1.update_cells(t2.filter(t2.id.is_in(...))) or intersect universes first
- If rows may be new, use table_static_changed_rows-free composition like update_rows or concat-with-new-ids instead
- Sanity-check id overlap in tests with pw.debug.compute_and_print before asserting
Example fix
# before t3 = t1.update_cells(t2) # ValueError: universe not a subset # after (only if t2's keys really are a subset of t1's) pw.universes.promise_is_subset_of(t2, t1) t3 = t1.update_cells(t2)
Defensive patterns
Strategy: validation
Validate before calling
# Only promise when the subset relation truly holds
import pathway as pw
def update_cells_subset(t1, t2):
pw.universes.promise_is_subset_of(t2, t1)
return t1.update_cells(t2) Try / catch
try:
t3 = t1.update_cells(t2)
except ValueError as e:
if 'needs to be a subset' in str(e):
pw.universes.promise_is_subset_of(t2, t1)
t3 = t1.update_cells(t2) Prevention
- Filter the update source to ids known to exist before update_cells
- Assert subset relations once at pipeline setup, not per call
- A false promise_is_subset_of can crash the runtime — verify in tests first
When it happens
Trigger: t1.update_cells(t2) where t2 may contain ids not present in t1 (t2 built from a different source, or filtered differently); universe solver says other._universe.is_subset_of(self._universe) is False.
Common situations: Applying updates from a wider/parallel source table; updates arriving for keys that were filtered out of the base table; forgetting that promise_is_subset_of is required when ids come from separate connectors.
Related errors
- You cannot use {dep.to_column_expression()} in this context.
- not all arguments marked as iterated returned from iteration
- iterated table not marked as 'iterate_universe' changed its
- Universes of all arguments of Table.from_columns() have to b
- Universes of all arguments of Table.__add__() have to be equ
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/5e682eb0a4304318.
Report an issue: GitHub.