{"record":{"id":"2a03d5c627a49335","repo":"microsoft/autogen","slug":"reference-ref-name-not-found-in-cache-availab","errorCode":null,"errorMessage":"Reference `{ref_name}` not found in cache. Available: {list(self._model_cache.keys())}","messagePattern":"Reference `(.+?)` not found in cache\\. Available: (.+?)","errorType":"exception","errorClass":"ReferenceNotFoundError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-core/src/autogen_core/utils/_json_to_pydantic.py","lineNumber":122,"sourceCode":"\nclass _JSONSchemaToPydantic:\n    def __init__(self) -> None:\n        self._model_cache: Dict[str, Optional[Union[Type[BaseModel], ForwardRef]]] = {}\n\n    def _resolve_ref(self, ref: str, schema: Dict[str, Any]) -> Dict[str, Any]:\n        ref_key = ref.split(\"/\")[-1]\n        definitions = cast(dict[str, dict[str, Any]], schema.get(\"$defs\", {}))\n\n        if ref_key not in definitions:\n            raise ReferenceNotFoundError(\n                f\"Reference `{ref}` not found in `$defs`. Available keys: {list(definitions.keys())}\"\n            )\n\n        return definitions[ref_key]\n\n    def get_ref(self, ref_name: str) -> Any:\n        if ref_name not in self._model_cache:\n            raise ReferenceNotFoundError(\n                f\"Reference `{ref_name}` not found in cache. Available: {list(self._model_cache.keys())}\"\n            )\n\n        if self._model_cache[ref_name] is None:\n            return ForwardRef(ref_name)\n\n        return self._model_cache[ref_name]\n\n    def _get_item_model_name(self, array_field_name: str, parent_model_name: str) -> str:\n        \"\"\"Generate hash-based model names for array items to keep names short and unique.\"\"\"\n        import hashlib\n\n        # Create a short hash of the full path to ensure uniqueness\n        full_path = f\"{parent_model_name}_{array_field_name}\"\n        hash_suffix = hashlib.md5(full_path.encode()).hexdigest()[:6]\n\n        # Use field name as-is with hash suffix\n        return f\"{array_field_name}_{hash_suffix}\"","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-core/src/autogen_core/utils/_json_to_pydantic.py#L104-L140","documentation":"Error \"Reference `{ref_name}` not found in cache. Available: {list(self._model_cache.keys())}\" thrown in microsoft/autogen.","triggerScenarios":"Thrown at python/packages/autogen-core/src/autogen_core/utils/_json_to_pydantic.py:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Resolve references in dependency order"],"exampleFix":"Register/convert the referenced model before referencing it","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}