{"record":{"id":"d97824876575bccb","repo":"microsoft/autogen","slug":"this-component-does-not-support-loading-from-past","errorCode":null,"errorMessage":"This component does not support loading from past versions","messagePattern":"This component does not support loading from past versions","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-core/src/autogen_core/_component_config.py","lineNumber":114,"sourceCode":"        \"\"\"\n        raise NotImplementedError(\"This component does not support dumping to config\")\n\n    @classmethod\n    def _from_config_past_version(cls, config: Dict[str, Any], version: int) -> Self:\n        \"\"\"Create a new instance of the component from a previous version of the configuration object.\n\n        This is only called when the version of the configuration object is less than the current version, since in this case the schema is not known.\n\n        Args:\n            config (Dict[str, Any]): The configuration object.\n            version (int): The version of the configuration object.\n\n        Returns:\n            Self: The new instance of the component.\n\n        :meta public:\n        \"\"\"\n        raise NotImplementedError(\"This component does not support loading from past versions\")\n\n\nclass ComponentToConfig(Generic[ToConfigT]):\n    \"\"\"The two methods a class must implement to be a component.\n\n    Args:\n        Protocol (ConfigT): Type which derives from :py:class:`pydantic.BaseModel`.\n    \"\"\"\n\n    component_type: ClassVar[ComponentType]\n    \"\"\"The logical type of the component.\"\"\"\n    component_version: ClassVar[int] = 1\n    \"\"\"The version of the component, if schema incompatibilities are introduced this should be updated.\"\"\"\n    component_provider_override: ClassVar[str | None] = None\n    \"\"\"Override the provider string for the component. This should be used to prevent internal module names being a part of the module name.\"\"\"\n    component_description: ClassVar[str | None] = None\n    \"\"\"A description of the component. If not provided, the docstring of the class will be used.\"\"\"\n    component_label: ClassVar[str | None] = None","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-core/src/autogen_core/_component_config.py#L96-L132","documentation":"_from_config_past_version is the hook invoked when loading a ComponentModel whose config_version is lower than the class's component_version. The default implementation raises NotImplementedError, so any component with component_version > 1 must implement it to load older serialized configs.","triggerScenarios":"A class sets component_version = 2 but only implements _from_config; loading a previously dumped ComponentModel recorded at version 1 then hits _from_config_past_version and raises.","commonSituations":"Evolving a component's config schema across releases and bumping component_version without writing a migration; loading old artifacts (saved workflows/teams) after an upgrade.","solutions":["Implement _from_config_past_version(cls, config: dict, version: int) to migrate the old dict to the current config and call cls/_from_config.","Alternatively keep component_version at 1 and make new fields optional-with-defaults so old payloads still validate.","Re-dump artifacts after upgrading so they carry the current version."],"exampleFix":"# before\nclass MyComponent(ComponentBase[MyConfig]):\n    component_version = 2\n    # no _from_config_past_version -> loading v1 dumps fails\n\n# after\nclass MyComponent(ComponentBase[MyConfig]):\n    component_version = 2\n\n    @classmethod\n    def _from_config_past_version(cls, config: dict, version: int) -> \"MyComponent\":\n        if version == 1:\n            config = {**config, \"new_field\": \"default\"}\n        return cls._from_config(MyConfig(**config))","handlingStrategy":"fallback","validationCode":"loaded_version = model.config_version if isinstance(model, ComponentModel) else model.get(\"config_version\", 1)\nif loaded_version < MyComponent.component_version and MyComponent._from_config_past_version is ComponentBase._from_config_past_version:\n    raise ValueError(\"old config version; migration hook missing\")","typeGuard":null,"tryCatchPattern":"try:\n    obj = MyComponent.load_component(old_model)\nexcept NotImplementedError as e:\n    if \"past versions\" in str(e):\n        # manual migration: coerce old dict into current config shape\n        cfg = {**old_model.config, \"new_field\": \"default\"}\n        obj = MyComponent._from_config(MyConfig(**cfg))\n    else:\n        raise","preventionTips":["Whenever you bump component_version, write _from_config_past_version for every prior version.","Keep old serialized artifacts around in tests and add load-backward compatibility tests.","Prefer additive, defaulted config fields over version bumps when possible."],"tags":["autogen-core","component-config","versioning","migration"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}