microsoft/semantic-kernel · error · ValueError
Unknown destination type: {type(destination)}
Error message
Unknown destination type: {type(destination)} What it means
Raised by the tracer's _get_destination_str when the destination is not one of the four supported types: AgentId, TopicId, str, or None. The method maps a messaging destination to a string for the span name; any other type raises ValueError.
Source
Thrown at python/semantic_kernel/agents/runtime/core/telemetry/tracing_config.py:190
SpanKind: The span kind based on the messaging operation.
"""
if operation in ["create", "send", "publish"]:
return SpanKind.PRODUCER
if operation in ["receive", "intercept", "process", "ack"]:
return SpanKind.CONSUMER
return SpanKind.CLIENT
# TODO(evmattso): Use stringified convention
def _get_destination_str(self, destination: MessagingDestination) -> str:
if isinstance(destination, AgentId):
return f"{destination.type}.({destination.key})-A"
if isinstance(destination, TopicId):
return f"{destination.type}.({destination.source})-T"
if isinstance(destination, str):
return destination
if destination is None:
return ""
raise ValueError(f"Unknown destination type: {type(destination)}")
def _get_operation_type(self, operation: MessagingOperation) -> str:
if operation in ["send", "publish"]:
return "publish"
if operation in ["create"]:
return "create"
if operation in ["receive", "intercept", "ack"]:
return "receive"
if operation in ["process"]:
return "process"
return "Unknown"
View on GitHub (pinned to c028a0c7dc)
Solutions
- Pass an AgentId, TopicId, str, or None as the destination.
- Convert custom destinations to a string before tracing.
- Extend the tracer configuration if a new destination type is genuinely needed.
Example fix
// before
span = tracer.start_span(destination={'type': 'x', 'key': 'y'}) # dict -> ValueError
// after
span = tracer.start_span(destination=AgentId(type='x', key='y')) Defensive patterns
Strategy: type-guard
Validate before calling
def is_supported_destination(d) -> bool:
from semantic_kernel.agents.runtime.core import AgentId, TopicId
return d is None or isinstance(d, (AgentId, TopicId, str)) Type guard
from semantic_kernel.agents.runtime.core import AgentId, TopicId
def is_messaging_destination(d) -> bool:
return d is None or isinstance(d, (AgentId, TopicId, str)) Prevention
- Only pass AgentId, TopicId, str, or None as a destination.
- Convert custom destinations to str before they reach the tracer.
- Extend the tracer if a new destination type is required.
When it happens
Trigger: Passing a destination object that is not AgentId, TopicId, str, or None: a custom destination class, a dict, an int, or a tuple.
Common situations: Custom runtime integrations that introduce new destination types without extending the tracer; passing a raw dict or primitive as a destination.
Related errors
- Configuration key '{section}:{key}' not found
- Sample plugin path not found.
- AI service not recognized.
- Unknown metadata type: {type(metadata)}
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/fb140e8bc8902656.
Report an issue: GitHub.