microsoft/autogen · error · ValueError

Unknown attribute kind

Error message

Unknown attribute kind

What it means

Raised inside _worker_runtime.py's CloudEvent attribute stringifier while processing an incoming gRPC CloudEvent. The code inspects the protobuf oneof field 'attr' on each CloudEvent.CloudEventAttributeValue and only knows the kinds ce_boolean, ce_integer, ce_string, ce_bytes, ce_uri, ce_uri_ref, and ce_timestamp. If the attribute's oneof resolves to anything else (or is unset and falls to the wildcard case), the worker raises ValueError('Unknown attribute kind') instead of silently mistranslating the attribute. In practice this means the worker received an event whose attribute encoding does not match the protobuf schema it was compiled against.

Source

Thrown at python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime.py:683

                    for key, value in attributes.items():
                        item = None
                        match value.WhichOneof("attr"):
                            case "ce_boolean":
                                item = str(value.ce_boolean)
                            case "ce_integer":
                                item = str(value.ce_integer)
                            case "ce_string":
                                item = value.ce_string
                            case "ce_bytes":
                                item = str(value.ce_bytes)
                            case "ce_uri":
                                item = value.ce_uri
                            case "ce_uri_ref":
                                item = value.ce_uri_ref
                            case "ce_timestamp":
                                item = str(value.ce_timestamp)
                            case _:
                                raise ValueError("Unknown attribute kind")
                        result[key] = item

                    return result

                async def send_message(agent: Agent, message_context: MessageContext) -> Any:
                    with self._trace_helper.trace_block(
                        "process",
                        agent.id,
                        parent=stringify_attributes(event.attributes),
                        extraAttributes={"message_type": message_type},
                    ):
                        await agent.on_message(message, ctx=message_context)

                future = send_message(agent, message_context)
            responses.append(future)
        # Wait for all responses.
        try:
            await asyncio.gather(*responses)

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Pin the host and all workers to the same autogen-ext version (and therefore the same agent_worker/cloudevent protos) so the attribute schema matches
  2. Regenerate/refresh installed protos: reinstall the package (pip install -U 'autogen-core[grpc] autogen-ext[grpc]') in every process of the deployment
  3. If you control the publisher, restrict CloudEvent extension attributes to plain string types, which map to ce_string and are always handled
  4. If you must interoperate across versions, catch ValueError around message processing and drop/log the offending event rather than letting it crash the worker loop

Example fix

# before: host on autogen-ext 0.4.x, worker on 0.2.x -> mismatched cloudevent proto
# after: lock identical versions everywhere
# requirements.txt (same in host and worker images)
autogen-ext==0.4.31
autogen-core==0.4.31
Defensive patterns

Strategy: try-catch

Validate before calling

def cloudevent_attrs_supported(event) -> bool:
    kinds = {'ce_boolean','ce_integer','ce_string','ce_bytes','ce_uri','ce_uri_ref','ce_timestamp'}
    return all(v.WhichOneof('attr') in kinds for v in event.attributes.values())

Try / catch

try:
    await runtime.process_event(event)
except ValueError as e:
    if 'Unknown attribute kind' in str(e):
        logger.warning('Dropping event %s: unsupported attribute encoding (version skew?)', event.id)
    else:
        raise

Prevention

When it happens

Trigger: A GrpcWorkerAgentRuntime receives a CloudEvent from the host (or another worker) whose attribute oneof is not one of the seven handled kinds — typically because the host process runs a different autogen-ext/protobuf version that serializes attributes with a newer field, or the event was hand-crafted/malformed. It fires during _process_event, i.e. on message delivery, not at registration time.

Common situations: Version skew between the host runtime and worker runtime in a distributed deployment (host upgraded, worker pinned to an old release); mixed autogen-ext versions across containers; replaying captured protobuf events against a newer/older worker; proxies writing custom attributes into the CloudEvent envelope.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/a543db748647470f. Report an issue: GitHub.