microsoft/autogen · error · ValueError
Unsupported payload serialization format: {payload_serializa
Error message
Unsupported payload serialization format: {payload_serialization_format} What it means
GrpcWorkerAgentRuntime accepts a payload_serialization_format constructor argument that selects how message payloads cross the wire. Only the JSON and Protobuf content types (JSON_DATA_CONTENT_TYPE / PROTOBUF_DATA_CONTENT_TYPE) are implemented; anything else is rejected in __init__ with ValueError so misconfiguration fails before the runtime starts.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime.py:257
self._agent_factories: Dict[
str, Callable[[], Agent | Awaitable[Agent]] | Callable[[AgentRuntime, AgentId], Agent | Awaitable[Agent]]
] = {}
self._instantiated_agents: Dict[AgentId, Agent] = {}
self._known_namespaces: set[str] = set()
self._read_task: None | Task[None] = None
self._running = False
self._pending_requests: Dict[str, Future[Any]] = {}
self._pending_requests_lock = asyncio.Lock()
self._next_request_id = 0
self._host_connection: HostConnection | None = None
self._background_tasks: Set[Task[Any]] = set()
self._subscription_manager = SubscriptionManager()
self._serialization_registry = SerializationRegistry()
self._extra_grpc_config = extra_grpc_config or []
self._agent_instance_types: Dict[str, Type[Agent]] = {}
if payload_serialization_format not in {JSON_DATA_CONTENT_TYPE, PROTOBUF_DATA_CONTENT_TYPE}:
raise ValueError(f"Unsupported payload serialization format: {payload_serialization_format}")
self._payload_serialization_format = payload_serialization_format
async def start(self) -> None:
"""Start the runtime in a background task."""
if self._running:
raise ValueError("Runtime is already running.")
logger.info(f"Connecting to host: {self._host_address}")
self._host_connection = await HostConnection.from_host_address(
self._host_address, extra_grpc_config=self._extra_grpc_config
)
logger.info("Connection established")
if self._read_task is None:
self._read_task = asyncio.create_task(self._run_read_loop())
self._running = True
def _raise_on_exception(self, task: Task[Any]) -> None:
exception = task.exception()View on GitHub (pinned to 027ecf0a37)
Solutions
- Use one of the supported constants: autogen_core.application JSON_DATA_CONTENT_TYPE ('application/json') or PROTOBUF_DATA_CONTENT_TYPE ('application/x-protobuf')
- For custom payload types, register a serializer with the runtime's serialization registry and keep the wire format as JSON or protobuf
- If you truly need a new wire format, subclass/extend the runtime rather than passing an unknown string
Example fix
# before runtime = GrpcWorkerAgentRuntime(host_address, payload_serialization_format="msgpack") # after from autogen_ext.runtimes.grpc._constants import PROTOBUF_DATA_CONTENT_TYPE runtime = GrpcWorkerAgentRuntime(host_address, payload_serialization_format=PROTOBUF_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_FORMATS = {JSON_DATA_CONTENT_TYPE, PROTOBUF_DATA_CONTENT_TYPE}
assert payload_serialization_format in SUPPORTED_FORMATS, f"use one of {SUPPORTED_FORMATS}" Try / catch
try:
runtime = GrpcWorkerAgentRuntime(host, payload_serialization_format=fmt)
except ValueError as e:
if "serialization format" in str(e):
fmt = JSON_DATA_CONTENT_TYPE
runtime = GrpcWorkerAgentRuntime(host, payload_serialization_format=fmt)
else:
raise Prevention
- Always pass the module constants, never string literals
- Centralize runtime construction in one factory function
- Assert supported formats in config validation at app startup
When it happens
Trigger: Constructing GrpcWorkerAgentRuntime(host_address=..., payload_serialization_format='application/x-my-format') or any string other than the two supported content-type constants.
Common situations: Assuming an arbitrary MIME type or serializer name works; passing a custom serialization registry format id instead of the content-type constant; copy-paste from docs showing protobuf while sending a custom string.
Related errors
- Unsupported message content type: {message_content_type}
- 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/4cd66ab3ac75a99c.
Report an issue: GitHub.