microsoft/autogen · error · ValueError
Unsupported message content type: {message_content_type}
Error message
Unsupported message content type: {message_content_type} What it means
When a CloudEvent arrives, GrpcWorkerAgentRuntime._process_event deserializes the payload according to the event's datacontenttype. Only JSON_DATA_CONTENT_TYPE and PROTOBUF_DATA_CONTENT_TYPE are recognized; any other content type raises ValueError('Unsupported message content type: ...') and the event is dropped (logged as a read-loop/background-task error).
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime.py:634
topic_id = TopicId(event.type, event.source)
# Get the recipients for the topic.
recipients = await self._subscription_manager.get_subscribed_recipients(topic_id)
message_content_type = event_attributes[_constants.DATA_CONTENT_TYPE_ATTR].ce_string
message_type = event_attributes[_constants.DATA_SCHEMA_ATTR].ce_string
if message_content_type == JSON_DATA_CONTENT_TYPE:
message = self._serialization_registry.deserialize(
event.binary_data, type_name=message_type, data_content_type=message_content_type
)
elif message_content_type == PROTOBUF_DATA_CONTENT_TYPE:
# TODO: find a way to prevent the roundtrip serialization
proto_binary_data = event.proto_data.SerializeToString()
message = self._serialization_registry.deserialize(
proto_binary_data, type_name=message_type, data_content_type=message_content_type
)
else:
raise ValueError(f"Unsupported message content type: {message_content_type}")
# TODO: dont read these values in the runtime
topic_type_suffix = topic_id.type.split(":", maxsplit=1)[1] if ":" in topic_id.type else ""
is_rpc = topic_type_suffix == _constants.MESSAGE_KIND_VALUE_RPC_REQUEST
is_marked_rpc_type = (
_constants.MESSAGE_KIND_ATTR in event_attributes
and event_attributes[_constants.MESSAGE_KIND_ATTR].ce_string == _constants.MESSAGE_KIND_VALUE_RPC_REQUEST
)
if is_rpc and not is_marked_rpc_type:
warnings.warn("Received RPC request with topic type suffix but not marked as RPC request.", stacklevel=2)
# Send the message to each recipient.
responses: List[Awaitable[Any]] = []
for agent_id in recipients:
if agent_id == sender:
continue
message_context = MessageContext(
sender=sender,View on GitHub (pinned to 027ecf0a37)
Solutions
- Make all producers use one of the supported formats: configure payload_serialization_format with the JSON_DATA_CONTENT_TYPE or PROTOBUF_DATA_CONTENT_TYPE constant, not a free-form string
- Pin all workers to compatible autogen-ext versions so content types agree
- If external systems inject CloudEvents, convert their payloads to application/json before they reach subscribed workers
Example fix
# before (producer side) runtime = GrpcWorkerAgentRuntime(host, payload_serialization_format="application/vnd.custom") # after from autogen_ext.runtimes.grpc._constants import JSON_DATA_CONTENT_TYPE runtime = GrpcWorkerAgentRuntime(host, payload_serialization_format=JSON_DATA_CONTENT_TYPE)
Defensive patterns
Strategy: validation
Validate before calling
from autogen_ext.runtimes.grpc._constants import JSON_DATA_CONTENT_TYPE, PROTOBUF_DATA_CONTENT_TYPE
SUPPORTED = {JSON_DATA_CONTENT_TYPE, PROTOBUF_DATA_CONTENT_TYPE}
# verify config of every producer before start
assert runtime_payload_format in SUPPORTED, "all workers must use a supported content type" Try / catch
try:
await runtime.publish_message(msg, topic)
except ValueError as e:
# note: content-type rejection happens on the receiving worker; catch there:
# errors surface via background-task logging — monitor logs for 'Unsupported message content type'
raise Prevention
- Standardize payload_serialization_format across all workers via shared config
- Use the module constants instead of literal strings
- Pin all workers and the host to the same autogen-ext version
- Monitor worker logs for read-loop errors to catch mismatched producers
When it happens
Trigger: Another worker or host publishes a CloudEvent with datacontenttype set to something other than application/json or application/x-protobuf while this worker is subscribed to the topic — e.g. a producer with a different payload_serialization_format, or an external event injected into the host.
Common situations: Mixing worker versions or configs where one uses JSON and another a custom/protobuf-ish MIME string; publishing events into the host from non-AutoGen producers; typos in content-type strings.
Related errors
- Unsupported payload serialization format: {payload_serializa
- Unsupported subscription type.
- Invalid subscription message.
- Root types cannot be derived from each other: {rootType.Name
- Tool names must be unique: {tool_names}
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/1b3859217f8c8428.
Report an issue: GitHub.