pathwaycom/pathway · error · ValueError

Column {api.DIFF_PSEUDOCOLUMN} can only have 1 and -1 values

Error message

Column {api.DIFF_PSEUDOCOLUMN} can only have 1 and -1 values.

What it means

Pathway connectors' persistent state is keyed by a unique name; 'persistent_id' is the deprecated spelling of 'name' and the _get_unique_name helper refuses calls that supply both, because the intended identifier would be ambiguous.

Source

Thrown at python/pathway/debug/__init__.py:320

    for pseudocolumn in api.PANDAS_PSEUDOCOLUMNS:
        if pseudocolumn in df.columns:
            if not pd.api.types.is_integer_dtype(df[pseudocolumn].dtype):
                raise ValueError(f"Column {pseudocolumn} has to contain integers only.")
    if api.TIME_PSEUDOCOLUMN in df.columns:
        if any(df[api.TIME_PSEUDOCOLUMN] < 0):
            raise ValueError(
                f"Column {api.TIME_PSEUDOCOLUMN} cannot contain negative times."
            )
        if any(df[api.TIME_PSEUDOCOLUMN] % 2 == 1):
            warn(
                "timestamps are required to be even; all timestamps will be doubled",
                stacklevel=stacklevel + 1,
            )
            df[api.TIME_PSEUDOCOLUMN] = 2 * df[api.TIME_PSEUDOCOLUMN]

    if api.DIFF_PSEUDOCOLUMN in df.columns:
        if any((df[api.DIFF_PSEUDOCOLUMN] != 1) & (df[api.DIFF_PSEUDOCOLUMN] != -1)):
            raise ValueError(
                f"Column {api.DIFF_PSEUDOCOLUMN} can only have 1 and -1 values."
            )


@check_arg_types
@trace_user_frame
def table_from_rows(
    schema: type[Schema],
    rows: list[tuple],
    unsafe_trusted_ids: bool = False,
    is_stream=False,
) -> Table:
    """A function for creating a table from a list of tuples. Each tuple should describe
    one row of the input data (or stream), matching provided schema.

    If ``is_stream`` is set to ``True``, each tuple representing a row should contain
    two additional columns, the first indicating the time of arrival of particular row
    and the second indicating whether the row should be inserted (1) or deleted (-1).

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Delete the persistent_id argument and keep only name.
  2. Search the codebase for persistent_id and migrate every remaining occurrence to name to avoid the separate DeprecationWarning path.

Example fix

# before
pw.io.csv.write(t, "out.csv", name="my-sink", persistent_id="my-sink")

# after
pw.io.csv.write(t, "out.csv", name="my-sink")
Defensive patterns

Strategy: validation

Validate before calling

def unique_name(name: str | None, persistent_id: str | None) -> str | None:
    if name is not None and persistent_id is not None:
        raise ValueError("pass only 'name', not both")
    return name or persistent_id

pw.io.csv.write(t, "out.csv", name=unique_name(name, persistent_id))

Prevention

When it happens

Trigger: Calling a Pathway IO connector (e.g. pw.io.csv.write, pw.io.kafka.read) with both name=... and persistent_id=... keyword arguments.

Common situations: Upgrading old Pathway code that used persistent_id while copy-pasting newer examples that use name; both end up in the same call and the API rejects the mix.

Related errors


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