pathwaycom/pathway · error · ValueError
The value column must have one of the following types: {allo
Error message
The value column must have one of the following types: {allowed_value_types} What it means
Raised by MessageQueueOutputFormat.build for raw/plaintext output when the value column's dtype is not in allowed_value_types (default (BYTES, STR, ANY)). Like keys, raw payloads are serialized as bytes, so only byte-like or string columns are accepted by default; the error names the allowed set. Connectors can pass a different allowed_value_types tuple.
Source
Thrown at python/pathway/io/_utils.py:593
)
else:
column_names = list(table._columns.keys())
if len(column_names) != 1:
raise ValueError(
f"'{format}' format without explicit 'value' specification "
"can only be used with single-column tables"
)
value = table[column_names[0]]
value_field_index = cls.add_column_reference_to_extract(
value, columns_to_extract, extracted_field_indices
)
table = table.select(*columns_to_extract)
if (
allowed_value_types is not None
and table[value._name]._column.dtype not in allowed_value_types
):
raise ValueError(
f"The value column must have one of the following types: {allowed_value_types}"
)
data_format = api.DataFormat(
format_type="single_column",
key_field_names=[],
value_fields=_format_output_value_fields(table),
value_field_index=value_field_index,
schema_registry_settings=maybe_schema_registry_settings(
schema_registry_settings
),
subject=subject,
)
else:
raise ValueError(f"Unsupported format: {format}")
return cls(
table=table,View on GitHub (pinned to fa2f74a464)
Solutions
- Cast the value column to string/bytes: value on pw.this.count.astype(str).
- Or pick a column that is already BYTES/STR as the payload.
- If the target system genuinely supports the dtype, pass an extended allowed_value_types tuple.
Example fix
# before pw.io.kafka.write(t, ..., format='raw') # single int column 'count' # after t = t.select(payload=pw.this.count.astype(str)) pw.io.kafka.write(t, ..., format='raw')
Defensive patterns
Strategy: type-guard
Validate before calling
value_dtype = table[value_name]._column.dtype
assert allowed_value_types is None or value_dtype in allowed_value_types, f"value dtype {value_dtype} not in {allowed_value_types}" Type guard
def value_dtype_allowed(dtype, allowed=(dt.BYTES, dt.STR, dt.ANY)) -> bool:
return dtype in allowed Try / catch
try:
pw.io.kafka.write(t, ..., format='raw')
except ValueError as e:
if 'value column' in str(e):
t = t.with_columns(payload=pw.this[value_name].astype(str))
pw.io.kafka.write(t.select(pw.this.payload), ..., format='raw')
else:
raise Prevention
- Serialize non-string payloads to str/bytes before raw sinks.
- Assert payload dtype early in the pipeline, not at sink construction.
When it happens
Trigger: pw.io.kafka.write(t, ..., format='raw') where the single/value column is int, float, or a complex type; schema evolution that retypes the payload column from bytes to something else.
Common situations: Tables whose payload column is numeric (counts, ids) because no serialization step was added; connector-specific serializers that accept a narrower/wider type set.
Related errors
- The topic name column must have a string type, however {topi
- The key column must have one of the following types: {allowe
- 'value' must be specified if 'key' is not None
- '{format}' format without explicit 'value' specification can
- Failed to install dependencies
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/08ec84275c17e319.
Report an issue: GitHub.