apache/beam · error · ValueError
Unsupported type for value of display data
Error message
Unsupported type %s for value of display data %s
What it means
Display data values must map to a protobuf LabelledPayload field (str, int, float, bool, timestamp, etc.). When converting DisplayData to its runner API proto, create_payload raises ValueError if the value's Python type has no supported payload representation.
Solutions
- Return a supported primitive (str, int, float, bool) from display_data() for that item.
- Convert the object with str(value) or a repr before returning it.
- If it's a Beam bug, wrap the value or upgrade to a version where the type is supported.
Example fix
// before
def display_data(self):
return {'conf': self.my_config_object}
// after
def display_data(self):
return {'conf': str(self.my_config_object)} Defensive patterns
Strategy: type-guard
Validate before calling
SUPPORTED = (str, int, float, bool)
for k, v in self.display_data().items():
assert isinstance(v, SUPPORTED), f'display data {k} has unsupported type {type(v)}' Type guard
def is_display_data_value(v) -> bool:
return isinstance(v, (str, int, float, bool)) Try / catch
try:
proto = display_data.to_proto()
except ValueError as e:
if 'Unsupported type' in str(e):
coerce_display_data_items_to_str(display_data)
proto = display_data.to_proto()
else:
raise Prevention
- Return only primitives from display_data()
- str()-coerce complex objects before returning them
- Unit-test to_proto() serialization of custom transforms
When it happens
Trigger: A transform's display_data() returns an item whose value is an arbitrary object (e.g. a custom class instance, dict, or callable) that DisplayDataItem does not classify into a supported type, during to_proto() serialization.
Common situations: Adding display_data entries returning custom config objects; refactor leaving a non-primitive in a display item; library upgrades adding display data with new value types.
Related errors
- Attempted to encode null for non-nullable field
- Decode not implemented
- Element of class . does not subclass HasDisplayData
- Element of class . does not subclass PipelineOptions
- Encode not implemented
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/482bd8e31d1a7d93.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/transforms/display.py:180
return beam_runner_api_pb2.LabelledPayload(
label=label,
bool_value=value,
key=display_data_dict['key'],
namespace=display_data_dict.get('namespace', ''))
elif isinstance(value, int):
return beam_runner_api_pb2.LabelledPayload(
label=label,
int_value=value,
key=display_data_dict['key'],
namespace=display_data_dict.get('namespace', ''))
elif isinstance(value, (float, complex)):
return beam_runner_api_pb2.LabelledPayload(
label=label,
double_value=value, # type: ignore[arg-type]
key=display_data_dict['key'],
namespace=display_data_dict.get('namespace', ''))
else:
raise ValueError(
'Unsupported type %s for value of display data %s' %
(type(value), label))
dd_protos = []
for dd in self.items:
if isinstance(dd, beam_runner_api_pb2.DisplayData):
dd_protos.append(dd)
else:
dd_payload = create_payload(dd)
if dd_payload:
dd_protos.append(
beam_runner_api_pb2.DisplayData(
urn=common_urns.StandardDisplayData.DisplayData.LABELLED.urn,
payload=dd_payload.SerializeToString()))
return dd_protos
@classmethod
def create_from_options(cls, pipeline_options):View on GitHub (pinned to 12126d8942)