pathwaycom/pathway · error · ValueError
DateTimeUtc must contain timezone information. Use pw.DateTi
Error message
DateTimeUtc must contain timezone information. Use pw.DateTimeNaive for naive datetimes.
What it means
DateTimeUtc is Pathway's pandas.Timestamp subclass that requires timezone awareness. __new__ raises when the constructed timestamp has tz is None, directing users to DateTimeNaive for wall-clock values. This keeps UTC-typed columns from silently holding ambiguous local times.
Source
Thrown at python/pathway/internals/datetime_types.py:24
class DateTimeNaive(pd.Timestamp):
"""Type for storing datetime without timezone information. Extends `pandas.Timestamp` type."""
def __new__(cls, *args, **kwargs):
obj = super().__new__(cls, *args, **kwargs)
if obj.tz is not None:
raise ValueError(
"DateTimeNaive cannot contain timezone information. Use pw.DateTimeUtc for datetimes with a timezone."
)
return obj
class DateTimeUtc(pd.Timestamp):
"""Type for storing datetime with default timezone. Extends `pandas.Timestamp` type."""
def __new__(cls, *args, **kwargs):
obj = super().__new__(cls, *args, **kwargs)
if obj.tz is None:
raise ValueError(
"DateTimeUtc must contain timezone information. Use pw.DateTimeNaive for naive datetimes."
)
return obj
class Duration(pd.Timedelta):
"""Type for storing duration of time. Extends `pandas.Timedelta` type."""
pass
View on GitHub (pinned to fa2f74a464)
Solutions
- Localize naive values to UTC before use: pd.to_datetime(series).dt.tz_localize("UTC").
- Parse with utc=True up front: pd.to_datetime(series, utc=True).
- If the data is intentionally local wall-clock, type the column pw.DateTimeNaive instead.
Example fix
# before
value = pw.DateTimeUtc(pd.Timestamp("2024-01-01 10:00:00")) # naive -> raises
# after
value = pw.DateTimeUtc(pd.Timestamp("2024-01-01 10:00:00").tz_localize("UTC")) Defensive patterns
Strategy: validation
Validate before calling
def to_utc(ts: pd.Timestamp) -> pd.Timestamp:
return ts.tz_localize('UTC') if ts.tz is None else ts.tz_convert('UTC') Type guard
import pandas as pd
def is_aware_timestamp(v) -> bool:
return isinstance(v, pd.Timestamp) and v.tz is not None Prevention
- Parse with pd.to_datetime(..., utc=True) for UTC columns.
- Refuse offset-less strings in sources feeding DateTimeUtc columns; fix at ingestion.
When it happens
Trigger: pw.DateTimeUtc("2024-01-01 10:00:00") (no offset), pw.DateTimeUtc(pd.Timestamp("2024-01-01")), or a DateTimeUtc-typed column/UDF receiving naive pandas timestamps.
Common situations: Source strings without offsets mapped to a DateTimeUtc schema; pandas loading that yields naive timestamps; arithmetic results of naive parsing passed into temporal joins expecting UTC.
Related errors
- DateTimeNaive cannot contain timezone information. Use pw.Da
- Unsupported type {input_type}, use pw.DATE_TIME_UTC or pw.DA
- If fmt is not a string, you need to specify whether objects
- Failed to detect the region of S3 bucket {bucket!r} (HTTP st
- SchemaRegistryHeader.value must be a str, got {type(self.val
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/e82f257babb7488b.
Report an issue: GitHub.