{"record":{"id":"7e2ffefb0fb59c28","repo":"pathwaycom/pathway","slug":"table-update-types-argument-name-has-to-be-an-ex","errorCode":null,"errorMessage":"Table.update_types() argument name has to be an existing table column name.","messagePattern":"Table\\.update_types\\(\\) argument name has to be an existing table column name\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/table.py","lineNumber":2237,"sourceCode":"            )\n        context = clmn.SetSchemaContext(\n            _id_column=self._id_column,\n            _new_properties={\n                self[name]._to_internal(): schema.column_properties(name)\n                for name in self.column_names()\n            },\n            _id_column_props=schema.__universe_properties__,\n        )\n        return self._table_with_context(context)\n\n    @trace_user_frame\n    @check_arg_types\n    def update_types(self, **kwargs: Any) -> Table:\n        \"\"\"Updates types in schema. Has no effect on the runtime.\"\"\"\n\n        for name in kwargs.keys():\n            if name not in self.keys():\n                raise ValueError(\n                    \"Table.update_types() argument name has to be an existing table column name.\"\n                )\n        new_schema = self.schema.with_types(**kwargs)\n        for name in kwargs.keys():\n            left = new_schema._dtypes()[name]\n            right = self.schema._dtypes()[name]\n            if not (\n                dt.dtype_issubclass(left, right) or dt.dtype_issubclass(right, left)\n            ):\n                raise TypeError(\n                    f\"Cannot change type from {right} to {left}.\\n\"\n                    + \"Table.update_types() should be used only for type narrowing or type extending.\"\n                )\n        return self._with_schema(new_schema)\n\n    @trace_user_frame\n    @check_arg_types\n    def update_id_type(self, id_type, *, id_append_only: bool | None = None) -> Table:","sourceCodeStart":2219,"sourceCodeEnd":2255,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/table.py#L2219-L2255","documentation":"Raised by Table.update_types() when a kwarg names a column that does not exist in the table. update_types only changes declared type hints on existing columns (it has no runtime effect), so unknown names are rejected before with_types is applied.","triggerScenarios":"t.update_types(missing_col=int) where 'missing_col' is not in t.keys(); typos; renaming earlier in the chain; schema drift between versions.","commonSituations":"Copy-pasting update_types calls between pipelines; connector schema changed so the column no longer exists; using update_types where with_columns (to add a column) was intended.","solutions":["Check names: print(t.column_names()) and fix the kwarg key","If you meant to add a new column, use with_columns instead","If the column was renamed upstream, update the kwarg to the new name","If you meant to cast values (not hints), use cast_to_types on an existing column"],"exampleFix":"# before\nt2 = t.update_types(ages=int)  # column is 'age'\n\n# after\nt2 = t.update_types(age=int)","handlingStrategy":"validation","validationCode":"def update_types_safe(t, **kwargs):\n    unknown = set(kwargs) - set(t.keys())\n    assert not unknown, f'unknown columns: {unknown}'\n    return t.update_types(**kwargs)","typeGuard":null,"tryCatchPattern":"try:\n    t2 = t.update_types(**hints)\nexcept ValueError as e:\n    if 'existing table column name' in str(e):\n        hints = {k: v for k, v in hints.items() if k in t.keys()}\n        t2 = t.update_types(**hints)","preventionTips":["Build kwargs from t.column_names() instead of hardcoding","Use with_columns to add columns, not update_types","Assert column presence at pipeline setup"],"tags":["pathway","typing","update-types","columns"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}