{"record":{"id":"d0307edd63d01985","repo":"pathwaycom/pathway","slug":"cannot-perform-name-when-column-of-type-dtypes","errorCode":null,"errorMessage":"Cannot perform {name} when column of type {dtypes_repr} is involved. Consider applying `await_futures()` to the table used here.","messagePattern":"Cannot perform (.+?) when column of type (.+?) is involved\\. Consider applying `await_futures\\(\\)` to the table used here\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/type_interpreter.py","lineNumber":649,"sourceCode":"        inner_dtype = expression._expr._dtype\n        replacement_dtype = expression._replacement._dtype\n        lca = dt.types_lca(inner_dtype, replacement_dtype, raising=False)\n        if lca is dt.ANY and inner_dtype is not dt.ANY:\n            raise TypeError(\n                \"Cannot perform pathway.fill_error on columns of types\"\n                + f\" {inner_dtype.typehint} and {replacement_dtype.typehint}.\"\n            )\n        return _wrap(expression, lca)\n\n    def _check_for_disallowed_types(self, name: str, *dtypes: dt.DType) -> None:\n        disallowed_dtypes: list[dt.DType] = []\n        for dtype in dtypes:\n            if isinstance(dtype, dt.Future):\n                disallowed_dtypes.append(dtype)\n        if disallowed_dtypes:\n            dtypes_repr = \", \".join(f\"{dtype.typehint}\" for dtype in disallowed_dtypes)\n            # adjust message if more than dt.Future is involved\n            raise TypeError(\n                f\"Cannot perform {name} when column of type {dtypes_repr} is involved.\"\n                + \" Consider applying `await_futures()` to the table used here.\"\n            )\n\n\nclass ReducerInterprerer(TypeInterpreter):\n    id_column_type: dt.DType\n\n    def __init__(self, id_column_type):\n        self.id_column_type = id_column_type\n        super().__init__()\n\n    def _pointer_type(self):\n        return self.id_column_type\n\n\nclass JoinTypeInterpreter(TypeInterpreter):\n    \"\"\"This type interpreter is used by JoinContext.","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/type_interpreter.py#L631-L667","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Apply table.await_futures() on the table before the failing operation","Reorder the pipeline so unwrap/fill_error run after await_futures()","Ensure you do not unwrap the Future column directly but the awaited result"],"exampleFix":"// before\nres = pw.unwrap(t.async_col)\n\n// after\nt = t.await_futures()\nres = pw.unwrap(t.async_col)","handlingStrategy":"validation","validationCode":"from pathway.internals import dtype as dt\n\ndef needs_await_futures(table) -> bool:\n    return any(\n        isinstance(col.dtype, dt.Future)\n        for col in table._columns.values()\n    )","typeGuard":"from pathway.internals import dtype as dt\n\ndef has_future_columns(table) -> bool:\n    return any(isinstance(c.dtype, dt.Future) for c in table._columns.values())","tryCatchPattern":"try:\n    res = pw.unwrap(t.col)\nexcept TypeError as e:\n    if 'await_futures' in str(e):\n        res = pw.unwrap(t.await_futures().col)\n    else:\n        raise","preventionTips":["Call await_futures() immediately after async UDF tables are produced","Standardize pipeline ordering: async UDF -> await_futures -> unwrap/reducers","Watch for dt.Future in table.schema during development"],"tags":["pathway","async","udf","futures","types"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}