pathwaycom/pathway · error · TypeError

Using column of type {dtype.typehint} is not allowed here. C

Error message

Using column of type {dtype.typehint} is not allowed here. Consider applying `await_futures()` to the table first.

What it means

Raised by Table._check_for_disallowed_types when an expression's evaluated dtype is dt.Future. Future-typed columns represent asynchronously computed values that are not yet available; most table operations refuse them until the futures have been awaited, and the error tells you to call await_futures().

Source

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

        )
        return self._table_with_context(context)

    def _validate_expression(self, expression: expr.ColumnExpression):
        for dep in expression._dependencies_above_reducer():
            if self._universe != dep._column.universe:
                raise ValueError(
                    f"You cannot use {dep.to_column_expression()} in this context."
                    + " Its universe is different than the universe of the table the method"
                    + " was called on. You can use <table1>.with_universe_of(<table2>)"
                    + " to assign universe of <table2> to <table1> if you're sure their"
                    + " sets of keys are equal."
                )

    def _check_for_disallowed_types(self, *expressions: expr.ColumnExpression):
        for expression in expressions:
            dtype = self.eval_type(expression)
            if isinstance(dtype, dt.Future):
                raise TypeError(
                    f"Using column of type {dtype.typehint} is not allowed here."
                    + " Consider applying `await_futures()` to the table first."
                )

    def _wrap_column_in_context(
        self,
        context: clmn.Context,
        column: clmn.Column,
        name: str,
        lineage: clmn.Lineage | None = None,
    ) -> clmn.Column:
        """Contextualize column by wrapping it in expression."""
        expression = expr.ColumnReference(_table=self, _column=column, _name=name)
        return expression._column_with_expression_cls(
            context=context,
            universe=context.universe,
            expression=expression,
            lineage=lineage,

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Call await_futures() on the table before using the column: t = t.await_futures()
  2. Check which columns are futures: inspect dtypes via t.schema / eval_type to find dt.Future
  3. If the column should never be a Future, fix the upstream expression/connector that produced it
  4. Keep awaiting immediately after the operation that creates futures, so downstream code never sees Future dtypes

Example fix

# before
t2 = t.with_columns(y=pw.this.async_result * 2)  # Future dtype -> TypeError

# after
t = t.await_futures()
t2 = t.with_columns(y=pw.this.async_result * 2)
Defensive patterns

Strategy: validation

Validate before calling

from pathway.internals import dtype as dt

def has_futures(t) -> bool:
    return any(isinstance(d, dt.Future) for d in t.schema._dtypes().values())

# t = t.await_futures() if has_futures(t)

Type guard

def is_future_free(t) -> bool:
    from pathway.internals import dtype as dt
    return not any(isinstance(d, dt.Future) for d in t.schema._dtypes().values())

Try / catch

try:
    t2 = t.with_columns(y=pw.this.col * 2)
except TypeError as e:
    if 'await_futures' in str(e):
        t2 = t.await_futures().with_columns(y=pw.this.col * 2)

Prevention

When it happens

Trigger: Using a column of dtype Future in contexts guarded by _check_for_disallowed_types — e.g. expressions produced by APIs returning futures (async connectors, async external calls) without awaiting, e.g. t.with_columns(y=pw.this.future_col * 2) on a table with a Future column.

Common situations: Using async I/O connectors or io.deprecated-like async helpers that produce Future columns; upgrading Pathway versions where some connector started returning futures; forgetting the await step in an async enrichment pipeline.

Related errors


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