{"record":{"id":"5e682eb0a4304318","repo":"pathwaycom/pathway","slug":"universe-of-the-argument-of-table-update-cells-n","errorCode":null,"errorMessage":"Universe of the argument of Table.update_cells() needs to be a subset of the universe of the updated table.\nConsider using Table.promise_is_subset_of() to assert this.\n(However, untrue assertion might result in runtime errors.)","messagePattern":"Universe of the argument of Table\\.update_cells\\(\\) needs to be a subset of the universe of the updated table\\.\nConsider using Table\\.promise_is_subset_of\\(\\) to assert this\\.\n\\(However, untrue assertion might result in runtime errors\\.\\)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/table.py","lineNumber":1761,"sourceCode":"        schema = {}\n        for key in other.keys():\n            schema[key] = _types_lca_with_error(\n                self.schema._dtypes()[key],\n                other.schema._dtypes()[key],\n                function_name=\"an update_cells\",\n                pointers=False,\n            )\n\n        return Table._update_cells(\n            self.cast_to_types(**schema), other.cast_to_types(**schema)\n        )\n\n    @trace_user_frame\n    @contextualized_operator\n    @check_arg_types\n    def _update_cells(self, other: Table) -> Table:\n        if not other._universe.is_subset_of(self._universe):\n            raise ValueError(\n                \"Universe of the argument of Table.update_cells() needs to be \"\n                + \"a subset of the universe of the updated table.\\n\"\n                + \"Consider using Table.promise_is_subset_of() to assert this.\\n\"\n                + \"(However, untrue assertion might result in runtime errors.)\"\n            )\n        context = clmn.UpdateCellsContext(\n            left=self._id_column,\n            right=other._id_column,\n            updates={name: other._columns[name] for name in other.keys()},\n        )\n        return self._table_with_context(context)\n\n    @trace_user_frame\n    @check_arg_types\n    def update_rows(self, other: Table[TSchema]) -> Table[TSchema]:\n        \"\"\"Updates rows of `self`, breaking ties in favor for the rows in `other`.\n\n        Semantics:","sourceCodeStart":1743,"sourceCodeEnd":1779,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/table.py#L1743-L1779","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nt3 = t1.update_cells(t2)  # ValueError: universe not a subset\n\n# after (only if t2's keys really are a subset of t1's)\npw.universes.promise_is_subset_of(t2, t1)\nt3 = t1.update_cells(t2)","handlingStrategy":"validation","validationCode":"# Only promise when the subset relation truly holds\nimport pathway as pw\n\ndef update_cells_subset(t1, t2):\n    pw.universes.promise_is_subset_of(t2, t1)\n    return t1.update_cells(t2)","typeGuard":null,"tryCatchPattern":"try:\n    t3 = t1.update_cells(t2)\nexcept ValueError as e:\n    if 'needs to be a subset' in str(e):\n        pw.universes.promise_is_subset_of(t2, t1)\n        t3 = t1.update_cells(t2)","preventionTips":["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"],"tags":["pathway","universe","update-cells","subset"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}