pathwaycom/pathway · error · TypeError

Unsupported type {input_type!r}.

Error message

Unsupported type {input_type!r}.

What it means

This TypeError is the catch-all branch of Pathway's dtype translation: the input type is not any of the recognized primitives (int, str, float, bool, bytes, Duration, DateTimeNaive/Utc, numpy scalars, and the composite types handled earlier). It means the type you declared for a column or annotation has no Pathway dtype mapping.

Source

Thrown at python/pathway/internals/dtype.py:766

        (arg,) = args
        return Future(wrap(arg))
    else:
        dtype = {
            int: INT,
            bool: BOOL,
            str: STR,
            float: FLOAT,
            datetime_types.Duration: DURATION,
            datetime_types.DateTimeNaive: DATE_TIME_NAIVE,
            datetime_types.DateTimeUtc: DATE_TIME_UTC,
            np.int32: INT,
            np.int64: INT,
            np.float32: FLOAT,
            np.float64: FLOAT,
            bytes: BYTES,
        }.get(input_type, None)
        if dtype is None:
            raise TypeError(f"Unsupported type {input_type!r}.")
        return dtype


ANY_TUPLE: DType = List(ANY)
ANY_ARRAY: DType = Array(n_dim=None, wrapped=ANY)
ANY_ARRAY_1D: DType = Array(n_dim=1, wrapped=ANY)
ANY_ARRAY_2D: DType = Array(n_dim=2, wrapped=ANY)
INT_ARRAY: DType = Array(n_dim=None, wrapped=INT)
INT_ARRAY_1D: DType = Array(n_dim=1, wrapped=INT)
INT_ARRAY_2D: DType = Array(n_dim=2, wrapped=INT)
FLOAT_ARRAY: DType = Array(n_dim=None, wrapped=FLOAT)
FLOAT_ARRAY_1D: DType = Array(n_dim=1, wrapped=FLOAT)
FLOAT_ARRAY_2D: DType = Array(n_dim=2, wrapped=FLOAT)


def dtype_equivalence(
    left: DType, right: DType, int_float_compatible: bool = True
) -> bool:

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Check the message's repr of the type against Pathway's supported list and switch to a supported dtype (e.g. datetime.date -> pw.DateTimeNaive, Decimal -> float or str)
  2. Wrap genuinely arbitrary python objects with pw.PyObjectWrapper[YourClass] (or pw.Json for JSON-serializable payloads)
  3. For containers, use explicit generic forms Pathway understands (pw.Json, tuple[...], list not supported -> use pw.Json or arrays)

Example fix

// before
from decimal import Decimal
class Orders(pw.Schema):
    total: Decimal
// after
class Orders(pw.Schema):
    total: pw.PyObjectWrapper[Decimal]  # or float, or pw.Json
Defensive patterns

Strategy: type-guard

Validate before calling

import datetime

SUPPORTED = {int, float, str, bool, bytes}

def assert_supported(annotation, name="field"):
    if annotation not in SUPPORTED and not str(annotation).startswith("pathway"):
        raise TypeError(f"{name}: unsupported annotation {annotation!r}; wrap with pw.PyObjectWrapper or use a pathway dtype")

Type guard

def is_pathway_compatible(tp) -> bool:
    import pathway as pw
    known = {int, float, str, bool, bytes, pw.DateTimeUtc, pw.DateTimeNaive, pw.Duration, pw.Json}
    return tp in known or str(getattr(tp, '__origin__', tp)).startswith(('pathway', 'typing.Optional'))

Try / catch

try:
    pw.schema_from_types(**fields)
except TypeError as e:
    if "Unsupported type" in str(e):
        # fall back to pw.PyObjectWrapper for the offending fields
        ...

Prevention

When it happens

Trigger: Schema fields annotated with unmapped stdlib/3rd-party types such as datetime.date, datetime.time, decimal.Decimal, complex, dict, set, or custom classes (not wrapped in pw.PyObjectWrapper); numpy types other than int32/int64/float32/float64; Optional[X] where X itself is unmapped.

Common situations: Reusing pydantic/dataclass models directly as schemas; annotating with datetime.date (common mistake — only DateTimeNaive/Utc exist); large custom classes expected to 'just work'; version changes that tightened accepted types.

Related errors


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