pathwaycom/pathway · error · TypeError
Usage of {base_this} not supported here.
Error message
Usage of {base_this} not supported here. What it means
Raised by ThisMetaclass._eval_substitution() when a this-variant proxy is evaluated in a context that provides no substitution table for it. Pathway resolves this-like references against a context table; if the concrete this (e.g. the base this of a join side or an io context's this) is not registered in the current substitution map, usage of it is unsupported there and a TypeError names the offending this.
Source
Thrown at python/pathway/internals/thisclass.py:137
raise TypeError("You cannot instantiate `this` class.")
def pointer_from(
self, *args: Any, optional=False, instance: expr.ColumnReference | None = None
):
return expr.PointerExpression(self, *args, optional=optional, instance=instance) # type: ignore[arg-type]
def _base_this(self) -> ThisMetaclass:
raise NotImplementedError
def _eval_table(self, table: Joinable) -> Joinable:
raise NotImplementedError
def _eval_substitution(
self, substitution: dict[ThisMetaclass, Joinable]
) -> Joinable:
base_this: ThisMetaclass = self._base_this()
if base_this not in substitution:
raise TypeError(f"Usage of {base_this} not supported here.")
return self._eval_table(substitution[base_this])
def _create_mock(self, name, args, kwargs) -> ThisMetaclass:
raise NotImplementedError
def _delayed_op(self, op, *, expression=None, name=None, qualname=None):
raise NotImplementedError
def _delay_depth(self):
raise NotImplementedError
def _expression(self):
raise NotImplementedError
def _with_new_expression(self, expression):
raise NotImplementedError
View on GitHub (pinned to fa2f74a464)
Solutions
- Rebuild the reference against a concrete table instead of the stale this: use table.col on the actual table object
- Keep join/this-referencing expressions inside the context that created them; pass plain column names to helper functions and rebind inside
- If you need this-like behavior in a helper, accept the table (or this) as an explicit parameter and use it consistently
Example fix
# before joined = t1.join(t2, t1.k == t2.k).select(t1.this.v) # may raise: usage of this not supported # after joined = t1.join(t2, t1.k == t2.k).select(t1.v, t2.w)
Defensive patterns
Strategy: type-guard
Validate before calling
def rebuild_ref(table, name: str):
"""Always bind references to a concrete table, never to a stale this."""
return table[name] Type guard
def ref_bound_to_concrete_table(ref) -> bool:
t = getattr(ref, "table", None)
return t is not None and not hasattr(t, "_base_this") Try / catch
try:
result = helper_using_this()
except TypeError as e:
if "not supported here" in str(e):
raise RuntimeError("rebuild the expression against a concrete table") from e
raise Prevention
- Do not store this-references from join/ingest contexts in variables that outlive the context
- Pass tables and column-name strings into helpers; bind references inside
- Keep expressions referencing t1.x/t2.x inline within the join call
When it happens
Trigger: Using the left/right this of a join (table_left.this / table_right.this) outside the expression context that defines it; keeping references produced inside a join or async connect context and reusing them later on another table; using pathway.this inside a custom expression evaluated where only a specific table was substituted.
Common situations: Storing column references from join contexts in variables and reusing them after the join finished; refactors that move join-side expressions into helper functions called outside the join; mixing this objects between different tables in helper utilities.
Related errors
- You cannot iterate over mock class.
- You cannot instantiate `this` class.
- direction argument of join should be of type asof_join.Direc
- The behavior argument of join should be of type pathway.temp
- The interval argument of a join should be of a type pathway.
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/eb9058964278d3b2.
Report an issue: GitHub.