pathwaycom/pathway · error · TypeError
Column {k!r} contains a value of unsupported type {type(v)._
Error message
Column {k!r} contains a value of unsupported type {type(v).__name__!r}. pw.io.milvus.write supports the following Pathway types: int, float, str, bool, pw.Json, list[float], bytes, and numpy.ndarray (1-D only). What it means
pw.io.milvus.write can only serialize a fixed set of Python/Pathway types: int, float, str, bool, pw.Json, list[float], bytes, and 1-D numpy arrays. Any other Python object in a row triggers this TypeError, naming the column and the unsupported type's name so the offending field is easy to locate.
Source
Thrown at python/pathway/io/milvus/__init__.py:48
to lists, and validates that every value belongs to a type the Milvus
connector supports. Raises ``TypeError`` with a descriptive message for
unsupported types, and ``ValueError`` for multi-dimensional arrays or for a
vector containing a non-finite (NaN / infinity) component.
"""
result = {}
for k, v in row.items():
if isinstance(v, _PwJson):
v = v.value
if isinstance(v, np.ndarray):
if v.ndim != 1:
raise ValueError(
f"Column {k!r} contains a {v.ndim}-dimensional numpy array. "
f"pw.io.milvus.write only supports 1-D arrays (for "
f"FLOAT_VECTOR / BINARY_VECTOR fields)."
)
v = v.tolist()
elif not isinstance(v, _SUPPORTED_TYPES):
raise TypeError(
f"Column {k!r} contains a value of unsupported type "
f"{type(v).__name__!r}. pw.io.milvus.write supports the "
f"following Pathway types: int, float, str, bool, pw.Json, "
f"list[float], bytes, and numpy.ndarray (1-D only)."
)
# A FLOAT_VECTOR (list / tuple / 1-D array of floats) with a non-finite
# component is silently stored by Milvus and corrupts the index —
# distances against NaN/infinity are meaningless. Reject it up front with
# a clear, column-named error, as the other vector sinks do.
if isinstance(v, (list, tuple)) and any(
isinstance(x, float) and not math.isfinite(x) for x in v
):
raise ValueError(
f"Column {k!r} contains a non-finite value (NaN or infinity) in "
f"its vector, which cannot be indexed by Milvus."
)
result[k] = v
return resultView on GitHub (pinned to fa2f74a464)
Solutions
- Convert the offending column before writing: datetimes via .strftime('%Y-%m-%dT%H:%M:%S'), dicts via pw.Json(...), numpy scalars via .item()
- Handle None with the column dtype's Optional type or replace with defaults so rows never carry raw None into the sink
- Inspect one materialized row (pw.debug.compute_and_print) to find which column holds the unsupported type
Example fix
# before
t = t.with_columns(created=t.created_at) # datetime objects
# after
t = t.with_columns(created=t.created_at.dt.strftime('%Y-%m-%dT%H:%M:%S')) Defensive patterns
Strategy: type-guard
Validate before calling
SUPPORTED = (int, float, str, bool, bytes, list, tuple)
def row_ok(row: dict) -> bool:
return all(v is None is False and isinstance(v, SUPPORTED) or type(v).__name__ == "Json" for v in row.values()) Type guard
def is_milvus_supported(v) -> bool:
return isinstance(v, (int, float, str, bool, bytes, np.ndarray)) or type(v).__name__ in ("Json", "list", "tuple") Try / catch
try:
pw.io.milvus.write(table, uri, "docs", primary_key=table.id)
except TypeError as e:
if "unsupported type" in str(e):
bad_col = str(e).split("'")[1] # column named in message
raise ValueError(f"Convert column {bad_col} (e.g. datetime -> ISO str) before writing") from e
raise Prevention
- Normalize rows before the sink: datetimes to ISO strings, dicts to pw.Json, numpy scalars to .item()
- Avoid None in non-optional columns by fixing the schema dtype
- Print one row with pw.debug.compute_and_print to spot exotic types early
When it happens
Trigger: Rows containing values such as datetime.datetime, None, dict (unwrapped from Json), set, np.float32 scalars, or tuples after preprocessing; commonly an apply() without dtype handling that leaks arbitrary objects.
Common situations: Leaking None from a UDF (use Optional/None handling in the schema); passing datetime objects instead of ISO strings; dicts not wrapped in pw.Json; numpy scalar types instead of Python scalars.
Related errors
- {role} {col._name!r} must be of type str, got {col._column.d
- Column {k!r} contains a {v.ndim}-dimensional numpy array. pw
- batch_size must be a positive integer, got {batch_size}.
- primary_key column {primary_key._name!r} does not belong to
- Failed to install dependencies
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/7a744bd1678c079d.
Report an issue: GitHub.