pathwaycom/pathway · error · ValueError

Schema.without() argument {name!r} has to refer to an existi

Error message

Schema.without() argument {name!r} has to refer to an existing column.

What it means

Schema.without(*args) removes columns by name (plain str or ColumnReference). Each name is popped from the columns dict; a KeyError on pop means the schema has no such column, converted into this ValueError naming the offending argument.

Source

Thrown at python/pathway/internals/schema.py:411

                    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:
                raise ValueError(
                    f"Schema.without() argument {name!r} has to refer to an existing column."
                )
        return schema_builder(columns=columns, id_dtype=self.id.dtype)

    def with_id_type(self, type, *, append_only: bool | None = None):
        type = dt.wrap(type)
        assert isinstance(type, dt.Pointer)
        columns: dict[str, ColumnDefinition] = {
            col.name: col.to_definition() for col in self.__columns__.values()
        }
        return schema_builder(
            columns=columns, id_dtype=type, id_append_only=append_only
        )

    def update_properties(self, **kwargs) -> type[Schema]:
        columns: dict[str, ColumnDefinition] = {
            col.name: dataclasses.replace(col.to_definition(), **kwargs)
            for col in self.__columns__.values()

View on GitHub (pinned to fa2f74a464)

Solutions

  1. List the schema's columns (MySchema.column_names()) and pass exact names.
  2. When passing a ColumnReference, ensure it comes from this schema's columns (e.g. via MySchema columns or the corresponding table's pw.this).
  3. Prefer without(pw.this.col) form inside table operations so names are checked against the right table.

Example fix

# before
S2 = MySchema.without('user_id')  # actual column: 'userId'

# after
S2 = MySchema.without('userId')
Defensive patterns

Strategy: validation

Validate before calling

import pathway as pw

def without_args_valid(schema_cls, args) -> bool:
    names = {a if isinstance(a, str) else a._name for a in args}
    return names <= set(schema_cls.keys())

Prevention

When it happens

Trigger: MySchema.without('user_id') when the column is called 'id' or 'userId'; also passing a ColumnReference whose _name belongs to a different table/schema.

Common situations: Trimming input schemas before a join or connector read; casing mismatches ('ID' vs 'id'); references taken from another table's column.

Related errors


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