{"record":{"id":"5515c7b41ffbea83","repo":"microsoft/autogen","slug":"model-model-not-found-in-model-info","errorCode":null,"errorMessage":"Model '{model}' not found in model info","messagePattern":"Model '(.+?)' not found in model info","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/models/anthropic/_model_info.py","lineNumber":152,"sourceCode":"    \"claude-3-7-sonnet-20250219\": 200000,\n    \"claude-instant-1.2\": 100000,\n    \"claude-2.0\": 100000,\n    \"claude-2.1\": 200000,\n}\n\n\ndef get_info(model: str) -> ModelInfo:\n    \"\"\"Get the model information for a specific model.\"\"\"\n    # Check for exact match first\n    if model in _MODEL_INFO:\n        return _MODEL_INFO[model]\n\n    # Check for partial match (for handling model variants)\n    for model_id in _MODEL_INFO:\n        if model.startswith(model_id.split(\"-2\")[0]):  # Match base name\n            return _MODEL_INFO[model_id]\n\n    raise KeyError(f\"Model '{model}' not found in model info\")\n\n\ndef get_token_limit(model: str) -> int:\n    \"\"\"Get the token limit for a specific model.\"\"\"\n    # Check for exact match first\n    if model in _MODEL_TOKEN_LIMITS:\n        return _MODEL_TOKEN_LIMITS[model]\n\n    # Check for partial match (for handling model variants)\n    for model_id in _MODEL_TOKEN_LIMITS:\n        if model.startswith(model_id.split(\"-2\")[0]):  # Match base name\n            return _MODEL_TOKEN_LIMITS[model_id]\n\n    # Default to a reasonable limit if model not found\n    return 100000\n","sourceCodeStart":134,"sourceCodeEnd":168,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/models/anthropic/_model_info.py#L134-L168","documentation":"Raised by autogen_ext.models.anthropic._model_info.get_info()/get_token_limit() as a KeyError when the model name passed to the Anthropic client is neither an exact key in the module-level _MODEL_INFO/_MODEL_TOKEN_LIMITS dicts nor a prefix match of any known base model id (matching is done on model_id.split(\"-2\")[0]). It means AutoGen has no capability/token-limit metadata for that model. This happens when the client is constructed without an explicit model_info and the bundled registry is stale relative to the model you use.","triggerScenarios":"Constructing AnthropicChatCompletionClient(model=\"claude-<new-or-typo'd-name>\") without supplying model_info, or calling get_info()/get_token_limit() directly with an unlisted id. Also triggered by variant suffixes that do not share the base-id prefix before \"-2\" (e.g. a dated snapshot name whose prefix differs from the registry keys).","commonSituations":"Anthropic releases a new Claude model before autogen-ext's _MODEL_INFO table is updated; user typos the model id; user pins an old autogen-ext version but targets a newer model.","solutions":["Pass explicit model_info to the client constructor (e.g. model_info={\"family\": ModelFamily.CLAUDE, \"vision\": ..., \"function_calling\": True, \"json_output\": True, \"structured_output\": False}) so the registry is never consulted","Upgrade autogen-ext to a version whose _MODEL_INFO table includes your model","Check the exact spelling against the keys in python/packages/autogen-ext/src/autogen_ext/models/anthropic/_model_info.py and use one of those ids (or a string starting with a registered base id before '-2')"],"exampleFix":"# before\nclient = AnthropicChatCompletionClient(model=\"claude-4-5-sonnet-2065\")\n\n# after\nfrom autogen_core.models import ModelInfo\nclient = AnthropicChatCompletionClient(\n    model=\"claude-4-5-sonnet-2065\",\n    model_info=ModelInfo(\n        family=\"claude\", vision=True, function_calling=True,\n        json_output=True, structured_output=False,\n    ),\n)","handlingStrategy":"validation","validationCode":"from autogen_ext.models.anthropic._model_info import _MODEL_INFO\n\ndef model_supported(model: str) -> bool:\n    if model in _MODEL_INFO:\n        return True\n    return any(model.startswith(mid.split(\"-2\")[0]) for mid in _MODEL_INFO)\n\nif not model_supported(MODEL):\n    # supply explicit model_info instead of relying on the registry\n    ...","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass explicit model_info for newly released or non-standard Anthropic model ids","Upgrade autogen-ext when adopting new Claude models","Wrap model-name configuration in a startup check against _MODEL_INFO keys"],"tags":["anthropic","model-registry","configuration","keyerror"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}