microsoft/autogen · error · ValueError
Invalid name: {name}. Name must be less than 64 characters.
Error message
Invalid name: {name}. Name must be less than 64 characters. What it means
Error "Invalid name: {name}. Name must be less than 64 characters." thrown in microsoft/autogen.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py:415
return AnthropicClientConfigurationConfigModel(**copied_config)
@classmethod
def _from_config(cls, config: AnthropicClientConfigurationConfigModel) -> Self:
copied_config = config.model_copy().model_dump(exclude_none=True)
return cls(**copied_config)
Normalize names by replacing invalid characters with underscore.
"""
return re.sub(r"[^a-zA-Z0-9_-]", "_", name)[:64]
def assert_valid_name(name: str) -> str:
"""
Ensure that configured names are valid, raises ValueError if not.
"""
if not re.match(r"^[a-zA-Z0-9_-]+$", name):
raise ValueError(f"Invalid name: {name}. Only letters, numbers, '_' and '-' are allowed.")
if len(name) > 64:
raise ValueError(f"Invalid name: {name}. Name must be less than 64 characters.")
return name
def normalize_stop_reason(stop_reason: str | None) -> FinishReasons:
if stop_reason is None:
return "unknown"
# Convert to lowercase for comparison
stop_reason = stop_reason.lower()
# Map Anthropic stop reasons to standard reasons
KNOWN_STOP_MAPPINGS: Dict[str, FinishReasons] = {
"end_turn": "stop",
"max_tokens": "length",
"stop_sequence": "stop",
"tool_use": "function_calls",
}
View on GitHub (pinned to 027ecf0a37)
Solutions
- Shorten the name below 64 characters
Example fix
Trim the name to <=64 chars
When it happens
Trigger: Thrown at python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py:415 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/96506feb87ec81a3.
Report an issue: GitHub.