{"record":{"id":"9ad6e3fc07463e1d","repo":"pathwaycom/pathway","slug":"using-column-of-type-dtype-typehint-is-not-allow","errorCode":null,"errorMessage":"Using column of type {dtype.typehint} is not allowed here. Consider applying `await_futures()` to the table first.","messagePattern":"Using column of type (.+?) is not allowed here\\. Consider applying `await_futures\\(\\)` to the table first\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/table.py","lineNumber":2521,"sourceCode":"        )\n        return self._table_with_context(context)\n\n    def _validate_expression(self, expression: expr.ColumnExpression):\n        for dep in expression._dependencies_above_reducer():\n            if self._universe != dep._column.universe:\n                raise ValueError(\n                    f\"You cannot use {dep.to_column_expression()} in this context.\"\n                    + \" Its universe is different than the universe of the table the method\"\n                    + \" was called on. You can use <table1>.with_universe_of(<table2>)\"\n                    + \" to assign universe of <table2> to <table1> if you're sure their\"\n                    + \" sets of keys are equal.\"\n                )\n\n    def _check_for_disallowed_types(self, *expressions: expr.ColumnExpression):\n        for expression in expressions:\n            dtype = self.eval_type(expression)\n            if isinstance(dtype, dt.Future):\n                raise TypeError(\n                    f\"Using column of type {dtype.typehint} is not allowed here.\"\n                    + \" Consider applying `await_futures()` to the table first.\"\n                )\n\n    def _wrap_column_in_context(\n        self,\n        context: clmn.Context,\n        column: clmn.Column,\n        name: str,\n        lineage: clmn.Lineage | None = None,\n    ) -> clmn.Column:\n        \"\"\"Contextualize column by wrapping it in expression.\"\"\"\n        expression = expr.ColumnReference(_table=self, _column=column, _name=name)\n        return expression._column_with_expression_cls(\n            context=context,\n            universe=context.universe,\n            expression=expression,\n            lineage=lineage,","sourceCodeStart":2503,"sourceCodeEnd":2539,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/table.py#L2503-L2539","documentation":"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().","triggerScenarios":"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.","commonSituations":"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.","solutions":["Call await_futures() on the table before using the column: t = t.await_futures()","Check which columns are futures: inspect dtypes via t.schema / eval_type to find dt.Future","If the column should never be a Future, fix the upstream expression/connector that produced it","Keep awaiting immediately after the operation that creates futures, so downstream code never sees Future dtypes"],"exampleFix":"# before\nt2 = t.with_columns(y=pw.this.async_result * 2)  # Future dtype -> TypeError\n\n# after\nt = t.await_futures()\nt2 = t.with_columns(y=pw.this.async_result * 2)","handlingStrategy":"validation","validationCode":"from pathway.internals import dtype as dt\n\ndef has_futures(t) -> bool:\n    return any(isinstance(d, dt.Future) for d in t.schema._dtypes().values())\n\n# t = t.await_futures() if has_futures(t)","typeGuard":"def is_future_free(t) -> bool:\n    from pathway.internals import dtype as dt\n    return not any(isinstance(d, dt.Future) for d in t.schema._dtypes().values())","tryCatchPattern":"try:\n    t2 = t.with_columns(y=pw.this.col * 2)\nexcept TypeError as e:\n    if 'await_futures' in str(e):\n        t2 = t.await_futures().with_columns(y=pw.this.col * 2)","preventionTips":["Call await_futures() immediately after operations that create futures","Check schema dtypes for Future after switching to async connectors","Keep async enrichment isolated at the start of the pipeline"],"tags":["pathway","async","future","typing"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}