{"record":{"id":"2cbd2a2ec1051395","repo":"microsoft/autogen","slug":"unknown-destination-type-type-destination","errorCode":null,"errorMessage":"Unknown destination type: {type(destination)}","messagePattern":"Unknown destination type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-core/src/autogen_core/_telemetry/_tracing_config.py","lineNumber":189,"sourceCode":"        if operation in [\"create\", \"send\", \"publish\"]:\n            return SpanKind.PRODUCER\n        elif operation in [\"receive\", \"intercept\", \"process\", \"ack\"]:\n            return SpanKind.CONSUMER\n        else:\n            return SpanKind.CLIENT\n\n    # TODO: Use stringified convention\n    def _get_destination_str(self, destination: MessagingDestination) -> str:\n        if isinstance(destination, AgentId):\n            return f\"{destination.type}.({destination.key})-A\"\n        elif isinstance(destination, TopicId):\n            return f\"{destination.type}.({destination.source})-T\"\n        elif isinstance(destination, str):\n            return destination\n        elif destination is None:\n            return \"\"\n        else:\n            raise ValueError(f\"Unknown destination type: {type(destination)}\")\n\n    def _get_operation_type(self, operation: MessagingOperation) -> str:\n        if operation in [\"send\", \"publish\"]:\n            return \"publish\"\n        if operation in [\"create\"]:\n            return \"create\"\n        elif operation in [\"receive\", \"intercept\", \"ack\"]:\n            return \"receive\"\n        elif operation in [\"process\"]:\n            return \"process\"\n        else:\n            return \"Unknown\"\n","sourceCodeStart":171,"sourceCodeEnd":202,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-core/src/autogen_core/_telemetry/_tracing_config.py#L171-L202","documentation":"The tracing config turns a messaging destination into a span attribute string; _get_destination_str accepts only AgentId, TopicId, plain str, or None. Any other object raises ValueError naming its type. This is an internal instrumentation helper, so the error almost always means a custom messaging path passed a non-standard destination object into tracing.","triggerScenarios":"Calling message-instrumentation code with a destination that is e.g. a tuple, int, or a custom wrapper type instead of AgentId/TopicId/str; a custom runtime subclass that forwards its own destination abstraction into the tracing config.","commonSituations":"Extending autogen-core with custom routing abstractions; test fakes that use string tuples for destinations; version upgrades where a destination field changed from str to a structured type in user adapters.","solutions":["Always pass AgentId, TopicId, str, or None as the destination to messaging operations.","If you have a custom destination object, stringify it (`str(dest)`) or map it to AgentId/TopicId before it reaches tracing.","Disable/replace the instrumentation config for the custom path if it cannot produce standard destinations."],"exampleFix":"# before\ntracer_config._get_destination_str((\"worker\", \"default\"))  # ValueError\n\n# after\ntracer_config._get_destination_str(AgentId(\"worker\", \"default\"))  # \"worker.(default)-A\"","handlingStrategy":"validation","validationCode":"def is_supported_destination(d: object) -> bool:\n    return d is None or isinstance(d, (AgentId, TopicId, str))","typeGuard":"from typing import Union, Optional\nfrom autogen_core import AgentId, TopicId\n\nMessagingDestinationLike = Optional[Union[AgentId, TopicId, str]]\n\ndef coerce_destination(d: MessagingDestinationLike) -> str:\n    return d if isinstance(d, str) else (\"\" if d is None else str(d))","tryCatchPattern":null,"preventionTips":["Type destination parameters as Union[AgentId, TopicId, str, None] at every custom transport boundary.","Stringify custom routing keys before passing messages into instrumented paths."],"tags":["python","autogen-core","telemetry","tracing","validation","internal-api"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}