pathwaycom/pathway · error · ValueError
Schema.with_types() argument name has to be an existing colu
Error message
Schema.with_types() argument name has to be an existing column name, received f{name}. What it means
Schema.with_types(**kwargs) rewrites the dtypes of existing columns. Every keyword name must match a column of the schema; an unknown name cannot be remapped, so schema.py raises this ValueError (the message text contains a formatting bug — 'received f{name}' prints a literal 'f' — but the offending name is still shown).
Source
Thrown at python/pathway/internals/schema.py:392
return pkey_fields if pkey_fields else None
def default_values(self) -> dict[str, Any]:
return {
name: column.default_value
for name, column in self.__columns__.items()
if column.has_default_value()
}
def keys(self) -> KeysView[str]:
return self.__columns__.keys()
def with_types(self, **kwargs) -> type[Schema]:
columns: dict[str, ColumnDefinition] = {
col.name: col.to_definition() for col in self.__columns__.values()
}
for name, dtype in kwargs.items():
if name not in columns:
raise ValueError(
f"Schema.with_types() argument name has to be an existing column name, received f{name}."
)
columns[name] = dataclasses.replace(columns[name], dtype=dt.wrap(dtype))
return schema_builder(columns=columns, id_dtype=self.id.dtype)
def without(self, *args: str | expr.ColumnReference) -> type[Schema]:
columns: dict[str, ColumnDefinition] = {
col.name: col.to_definition() for col in self.__columns__.values()
}
for arg in args:
if isinstance(arg, str):
name = arg
else:
name = arg._name
try:
columns.pop(name)
except KeyError:View on GitHub (pinned to fa2f74a464)
Solutions
- Check the schema's column names first (list(MySchema.keys()) or MySchema.column_names()) and use the exact name.
- If you need to add a column, use schema composition (SchemaA | SchemaB) or define a new schema instead of with_types.
- If the name should exist, fix the upstream rename so it does.
Example fix
# before S2 = MySchema.with_types(price=float) # column is 'cost' # after S2 = MySchema.with_types(cost=float)
Defensive patterns
Strategy: validation
Validate before calling
import pathway as pw
def with_types_args_valid(schema_cls, kwargs: dict) -> bool:
return set(kwargs.keys()) <= set(schema_cls.keys()) Prevention
- Derive with_types arguments from schema_cls.column_names() instead of typing names by hand.
- Add a schema unit test asserting column names after every upstream rename.
When it happens
Trigger: MySchema.with_types(price=float) when MySchema has no 'price' column (e.g. it is named 'cost' or 'amount'); also typos or renamed columns after refactors.
Common situations: Aligning CSV/json input schemas with connector expectations; renaming columns in a query but forgetting to update with_types calls.
Related errors
- Schema.without() argument {name!r} has to refer to an existi
- Failed to detect the region of S3 bucket {bucket!r} (HTTP st
- `{self.name}` has no attribute `{name}`
- You cannot use {dep.to_column_expression()} in this reduce s
- join condition should be of form <left_table>.<column> == <r
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/ef5ac4fc2b7006c8.
Report an issue: GitHub.