pathwaycom/pathway · error · ValueError
Column {api.TIME_PSEUDOCOLUMN} cannot contain negative times
Error message
Column {api.TIME_PSEUDOCOLUMN} cannot contain negative times. What it means
The start_from_timestamp_ms parameter is only meaningful when start_from="timestamp". The shared validation helper rejects any other combination so that the encoded value passed to the engine is unambiguous.
Source
Thrown at python/pathway/debug/__init__.py:308
if include_id:
series = pd.Series(columns[name], dtype=dtype)
else:
# we need to remove original keys, otherwise pandas will use them to create index
series = pd.Series(list(columns[name].values()), dtype=dtype)
series_dict[name] = series
index = keys if include_id else None
res = pd.DataFrame(series_dict, index=index)
return res
def _validate_dataframe(df: pd.DataFrame, stacklevel: int = 1) -> None:
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_frameView on GitHub (pinned to fa2f74a464)
Solutions
- Remove start_from_timestamp_ms from the call when start_from is not "timestamp".
- If you meant to start from a specific time, set start_from="timestamp" and keep the timestamp argument.
Example fix
# before pw.io.kafka.read(..., start_from="end", start_from_timestamp_ms=1700000000000) # after pw.io.kafka.read(..., start_from="end")
Defensive patterns
Strategy: validation
Validate before calling
def encode_start_from(start_from: str, ts: int | None) -> dict:
if start_from == "timestamp":
return {"start_from": "timestamp", "start_from_timestamp_ms": ts}
assert ts is None, "start_from_timestamp_ms only valid with start_from='timestamp'"
return {"start_from": start_from}
pw.io.kafka.read(..., **encode_start_from(start_from, ts)) Prevention
- Build connector kwargs programmatically so the timestamp key is only present in timestamp mode.
- Lint config files for leftover start_from_timestamp_ms keys after switching start_from.
When it happens
Trigger: Calling a Pathway IO read API with start_from set to anything other than "timestamp" (e.g. "start" or "end") while still passing a non-None start_from_timestamp_ms.
Common situations: User changes start_from from "timestamp" to "end" but leaves the old timestamp argument in place; or a config template supplies both keys and only one is updated when switching modes.
Related errors
- Failed to install dependencies
- 'subject' must be a non-empty string; got an empty string. S
- 'topic' must be a non-empty string; got {topic!r}. Kafka doe
- 'topic_name' must be a non-empty string; got an empty string
- Column {pseudocolumn} has to contain integers only.
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/8f99bc8a145c91c1.
Report an issue: GitHub.