pathwaycom/pathway · error · ValueError

Universes of all arguments of Table.__add__() have to be equ

Error message

Universes of all arguments of Table.__add__() have to be equal.
Consider using Table.promise_universes_are_equal() to assert it.
(However, untrue assertion might result in runtime errors.)

What it means

Table.__add__ (the + operator) horizontally concatenates two tables and is implemented as self.select(*self, *other), which requires both tables to have exactly equal universes. self._universe.is_equal_to(other._universe) is checked first; on mismatch ValueError is raised with a pointer to Table.promise_universes_are_equal().

Source

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

        >>> import pathway as pw
        >>> t1 = pw.debug.table_from_markdown('''
        ...    pet
        ... 1  Dog
        ... 7  Cat
        ... ''')
        >>> t2 = pw.debug.table_from_markdown('''
        ...    age
        ... 1   10
        ... 7    3
        ... ''')
        >>> t3 = t1 + t2
        >>> pw.debug.compute_and_print(t3, include_id=False)
        pet | age
        Cat | 3
        Dog | 10
        """
        if not self._universe.is_equal_to(other._universe):
            raise ValueError(
                "Universes of all arguments of Table.__add__() have to be equal.\n"
                + "Consider using Table.promise_universes_are_equal() to assert it.\n"
                + "(However, untrue assertion might result in runtime errors.)"
            )
        return self.select(*self, *other)

    @property
    def slice(self) -> TableSlice:
        """Creates a collection of references to self columns.
        Supports basic column manipulation methods.

        Example:

        >>> import pathway as pw
        >>> t1 = pw.debug.table_from_markdown('''
        ... age | owner | pet
        ... 10  | Alice | dog
        ... 9   | Bob   | dog

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Bring both to the same universe: t2 = t2.with_universe_of(t1) (or derive both from a common base table) before t1 + t2
  2. If ids are provably identical, use pw.Table.promise_universes_are_equal(t1, t2) — note a false promise causes runtime errors
  3. Prefer t1.with_columns(...) or a join keyed on id when the tables come from different sources

Example fix

# before
t3 = t1 + t2  # ValueError: universes not equal

# after
t3 = t1 + t2.with_universe_of(t1)
Defensive patterns

Strategy: validation

Validate before calling

def can_add(t1, t2) -> bool:
    return t1._universe.is_equal_to(t2._universe)

Type guard

import pathway as pw

def addable(t1: pw.Table, t2: pw.Table) -> bool:
    return t1._universe.is_equal_to(t2._universe)

Prevention

When it happens

Trigger: t3 = t1 + t2 where t1 and t2 have different row-id sets — one filtered, the result of an outer join, a table with an index column, or different connectors producing different ids.

Common situations: Merging feature columns computed in separate pipeline branches; adding a column derived after a filter; combining tables from markdown/debug fixtures whose implicit ids differ.

Related errors


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