pathwaycom/pathway · error · KeyError
Cannot assign id's for this join type.
Error message
Cannot assign id's for this join type.
What it means
JoinResult._compute_universe raises KeyError('Cannot assign id\'s for this join type.') when id is set to left_table._id_column but the mode is RIGHT or OUTER: the left table's ids cannot serve as identity when rows may be dropped (right join) or combined (outer). Only LEFT keeps the left universe; INNER requires a subset.
Source
Thrown at python/pathway/internals/joins.py:633
self._all_colnames = StableSet.union(
_original_left.keys(), _original_right.keys()
)
self._chained_join_desugaring = SubstitutionDesugaring(self._substitutions()[1])
@staticmethod
def _compute_universe(
left_table: Table,
right_table: Table,
id: clmn.Column | None,
mode: JoinMode,
) -> Universe:
if id is left_table._id_column:
if mode == JoinMode.LEFT:
return left_table._universe
elif mode == JoinMode.INNER:
return left_table._universe.subset()
else:
raise KeyError("Cannot assign id's for this join type.")
elif id is right_table._id_column:
if mode == JoinMode.RIGHT:
return right_table._universe
elif mode == JoinMode.INNER:
return right_table._universe.subset()
else:
raise KeyError("Cannot assign id's for this join type.")
else:
assert id is None
ret = Universe()
if (
(
mode in [JoinMode.LEFT, JoinMode.INNER]
and left_table._universe.is_empty()
)
or (
mode in [JoinMode.RIGHT, JoinMode.INNER]
and right_table._universe.is_empty()View on GitHub (pinned to fa2f74a464)
Solutions
- Remove the id= argument for right/outer joins and let pathway assign ids
- Keep the id column only with the matching mode: id=left.id with LEFT, id=right.id with RIGHT
- Use join_right()/join_inner() sugar APIs which select a consistent mode/id combination
Example fix
# before res = t1.join(t2, t1.k == t2.k, id=t1.id, how='right') # after res = t1.join_right(t2, t1.k == t2.k) # ids come from the right table
Defensive patterns
Strategy: validation
Validate before calling
def check_join_id(id, left, right, how: str) -> None:
if id is left._id_column:
assert how in ('left', 'inner'), f"id=left.id invalid for how={how}"
if id is right._id_column:
assert how in ('right', 'inner'), f"id=right.id invalid for how={how}" Prevention
- Prefer join_left/join_right/join_inner helpers which encode valid id/mode combinations
- Only pass id= when you specifically need to preserve one side's identity
When it happens
Trigger: join(t1, t2, ..., id=t1.id, how=JoinMode.RIGHT) or how='right'/'outer' with the left table's id column passed; equivalently using join_right-style APIs while forcing id=t1.id.
Common situations: Copying an inner/left-join snippet that sets id= and changing how= to right/outer without dropping the id argument; wanting deterministic ids after a right join.
Related errors
- Received `id` argument but was not expecting any. Not every
- Received `id` argument of join that is a string. Did you mea
- Join received extra kwargs. You probably want to use TableLi
- Expected a ColumnReference, found a string. Did you mean thi
- In JoinResult.groupby() all arguments have to be a ColumnRef
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/2f24e0103401ec3c.
Report an issue: GitHub.