pathwaycom/pathway · error · ValueError
TableSlice expects {repr(arg.name)} or this.{arg.name} argum
Error message
TableSlice expects {repr(arg.name)} or this.{arg.name} argument as column reference. What it means
Raised by TableSlice._normalize() when a ColumnReference argument is bound to a 'this'-like object (a ThisMetaclass instance) that is not the global pathway.this. Slices accept plain column names or references of the form this.col (or this['col']) only; any other this-variant reference is rejected.
Source
Thrown at python/pathway/internals/table_slice.py:143
)
@trace_user_frame
def ix_ref(self, *args, optional: bool = False, context=None) -> TableSlice:
new_table = self._table.ix_ref(*args, optional=optional, context=context)
return TableSlice(
{name: new_table[colref._name] for name, colref in self._mapping.items()},
new_table,
)
@property
def slice(self):
return self
def _normalize(self, arg: str | ColumnReference):
if isinstance(arg, ColumnReference):
if isinstance(arg.table, ThisMetaclass):
if arg.table != this:
raise ValueError(
f"TableSlice expects {repr(arg.name)} or this.{arg.name} argument as column reference."
)
else:
if arg.table != self._table:
raise ValueError(
"TableSlice method arguments should refer to table of which the slice was created."
)
return arg.name
else:
return arg
View on GitHub (pinned to fa2f74a464)
Solutions
- Pass the bare column name string instead of a foreign this reference: without('col') rather than without(other_this.col)
- Use the global reference form: pathway.this.col or pathway.this['col']
- Inside a join, first materialize the reference against the correct side (table.col) or wait until you are outside the join context
Example fix
# before
slice.without(result.this.col) # ValueError: expects 'col' or this.col
# after
slice.without("col")
# or
import pathway as pw
slice.without(pw.this.col) Defensive patterns
Strategy: type-guard
Validate before calling
import pathway as pw
def normalize_ref(ref):
"""Pass strings or global pw.this refs only."""
if isinstance(ref, pw.ColumnReference):
assert ref.table is pw.this or isinstance(ref, str), ref
return ref Type guard
def is_global_this_ref(ref) -> bool:
import pathway as pw
return isinstance(ref, str) or (
getattr(ref, "table", None) is pw.this
) Try / catch
try:
slice2 = table_slice.without(ref)
except ValueError as e:
if "expects" in str(e):
slice2 = table_slice.without(ref.name) # fall back to bare name
else:
raise Prevention
- Prefer plain column-name strings when calling TableSlice methods
- Never persist this-references from join contexts into later calls
- Standardize on pw.this.col / pw.this['col'] inside expressions
When it happens
Trigger: Passing a column reference built from a custom/joining this object (e.g. this_from a join context, async ingest context this, or a subclass of ThisMetaclass) into TableSlice methods such as without(), rename(), or __getitem__; passing table.this.col where table.this is not the global this.
Common situations: Inside join contexts where pathway exposes a different this for the left/right side; using a ThisMetaclass subclass produced by table slicing machinery; code copied from a join example into plain slice operations.
Related errors
- TableSlice method arguments should refer to table of which t
- parameters `schema` and `id_from` are mutually exclusive
- invalid ssl mode '{ssl_mode}', expected one of disable, allo
- SchemaRegistrySettings.urls must be a list of strings, got {
- invalid expression in restricted context
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/b186750a799338d1.
Report an issue: GitHub.