pathwaycom/pathway · error · TypeError

Cannot perform {name} when column of type {dtypes_repr} is i

Error message

Cannot perform {name} when column of type {dtypes_repr} is involved. Consider applying `await_futures()` to the table used here.

What it means

TypeError raised when an operation (unwrap, fill_error, etc. via _check_for_disallowed_types) is applied to a column of dtype Future. Future columns come from asynchronous UDFs/promises and cannot be used in these operations until materialized.

Source

Thrown at python/pathway/internals/type_interpreter.py:649

        inner_dtype = expression._expr._dtype
        replacement_dtype = expression._replacement._dtype
        lca = dt.types_lca(inner_dtype, replacement_dtype, raising=False)
        if lca is dt.ANY and inner_dtype is not dt.ANY:
            raise TypeError(
                "Cannot perform pathway.fill_error on columns of types"
                + f" {inner_dtype.typehint} and {replacement_dtype.typehint}."
            )
        return _wrap(expression, lca)

    def _check_for_disallowed_types(self, name: str, *dtypes: dt.DType) -> None:
        disallowed_dtypes: list[dt.DType] = []
        for dtype in dtypes:
            if isinstance(dtype, dt.Future):
                disallowed_dtypes.append(dtype)
        if disallowed_dtypes:
            dtypes_repr = ", ".join(f"{dtype.typehint}" for dtype in disallowed_dtypes)
            # adjust message if more than dt.Future is involved
            raise TypeError(
                f"Cannot perform {name} when column of type {dtypes_repr} is involved."
                + " Consider applying `await_futures()` to the table used here."
            )


class ReducerInterprerer(TypeInterpreter):
    id_column_type: dt.DType

    def __init__(self, id_column_type):
        self.id_column_type = id_column_type
        super().__init__()

    def _pointer_type(self):
        return self.id_column_type


class JoinTypeInterpreter(TypeInterpreter):
    """This type interpreter is used by JoinContext.

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Apply table.await_futures() on the table before the failing operation
  2. Reorder the pipeline so unwrap/fill_error run after await_futures()
  3. Ensure you do not unwrap the Future column directly but the awaited result

Example fix

// before
res = pw.unwrap(t.async_col)

// after
t = t.await_futures()
res = pw.unwrap(t.async_col)
Defensive patterns

Strategy: validation

Validate before calling

from pathway.internals import dtype as dt

def needs_await_futures(table) -> bool:
    return any(
        isinstance(col.dtype, dt.Future)
        for col in table._columns.values()
    )

Type guard

from pathway.internals import dtype as dt

def has_future_columns(table) -> bool:
    return any(isinstance(c.dtype, dt.Future) for c in table._columns.values())

Try / catch

try:
    res = pw.unwrap(t.col)
except TypeError as e:
    if 'await_futures' in str(e):
        res = pw.unwrap(t.await_futures().col)
    else:
        raise

Prevention

When it happens

Trigger: Calling pw.unwrap(t.col) or pw.fill_error(t.col, x) on a column produced by an async UDF (pathway.udfs / async_io) whose dtype is dt.Future; using the output column of a promise-returning transformation in unwrap/fill_error without awaiting it.

Common situations: Async UDF output consumed directly in downstream type-sensitive operations; migrating sync UDFs to async_executor and forgetting the await step; ordering apply/unwrap calls wrong in the pipeline.

Related errors


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