microsoft/autogen · error · NotImplementedError

This component does not support loading from past versions

Error message

This component does not support loading from past versions

What it means

_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.

Source

Thrown at python/packages/autogen-core/src/autogen_core/_component_config.py:114

        """
        raise NotImplementedError("This component does not support dumping to config")

    @classmethod
    def _from_config_past_version(cls, config: Dict[str, Any], version: int) -> Self:
        """Create a new instance of the component from a previous version of the configuration object.

        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.

        Args:
            config (Dict[str, Any]): The configuration object.
            version (int): The version of the configuration object.

        Returns:
            Self: The new instance of the component.

        :meta public:
        """
        raise NotImplementedError("This component does not support loading from past versions")


class ComponentToConfig(Generic[ToConfigT]):
    """The two methods a class must implement to be a component.

    Args:
        Protocol (ConfigT): Type which derives from :py:class:`pydantic.BaseModel`.
    """

    component_type: ClassVar[ComponentType]
    """The logical type of the component."""
    component_version: ClassVar[int] = 1
    """The version of the component, if schema incompatibilities are introduced this should be updated."""
    component_provider_override: ClassVar[str | None] = None
    """Override the provider string for the component. This should be used to prevent internal module names being a part of the module name."""
    component_description: ClassVar[str | None] = None
    """A description of the component. If not provided, the docstring of the class will be used."""
    component_label: ClassVar[str | None] = None

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Implement _from_config_past_version(cls, config: dict, version: int) to migrate the old dict to the current config and call cls/_from_config.
  2. Alternatively keep component_version at 1 and make new fields optional-with-defaults so old payloads still validate.
  3. Re-dump artifacts after upgrading so they carry the current version.

Example fix

# before
class MyComponent(ComponentBase[MyConfig]):
    component_version = 2
    # no _from_config_past_version -> loading v1 dumps fails

# after
class MyComponent(ComponentBase[MyConfig]):
    component_version = 2

    @classmethod
    def _from_config_past_version(cls, config: dict, version: int) -> "MyComponent":
        if version == 1:
            config = {**config, "new_field": "default"}
        return cls._from_config(MyConfig(**config))
Defensive patterns

Strategy: fallback

Validate before calling

loaded_version = model.config_version if isinstance(model, ComponentModel) else model.get("config_version", 1)
if loaded_version < MyComponent.component_version and MyComponent._from_config_past_version is ComponentBase._from_config_past_version:
    raise ValueError("old config version; migration hook missing")

Try / catch

try:
    obj = MyComponent.load_component(old_model)
except NotImplementedError as e:
    if "past versions" in str(e):
        # manual migration: coerce old dict into current config shape
        cfg = {**old_model.config, "new_field": "default"}
        obj = MyComponent._from_config(MyConfig(**cfg))
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/d97824876575bccb. Report an issue: GitHub.