microsoft/autogen · error · NotImplementedError

This component does not support dumping to config

Error message

This component does not support dumping to config

What it means

ComponentBase._from_config is a :meta public: hook that defaults to raising NotImplementedError. The message ('does not support dumping to config') is a copy-paste inaccuracy — this method LOADS a component from a ComponentConfig; subclasses that don't override it cannot be re-created from config via ComponentBase.load_component.

Source

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

        )
        return _TRUSTED_PROVIDER_NAMESPACES + extras
    return _TRUSTED_PROVIDER_NAMESPACES


class ComponentFromConfig(Generic[FromConfigT]):
    @classmethod
    def _from_config(cls, config: FromConfigT) -> Self:
        """Create a new instance of the component from a configuration object.

        Args:
            config (T): The configuration object.

        Returns:
            Self: The new instance of the component.

        :meta public:
        """
        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")

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Implement _from_config(cls, config) in the subclass: return cls(**config.model_dump()) or equivalent.
  2. If the class is only ever dumped, catch NotImplementedError and document it as dump-only.
  3. Prefer deriving from ComponentBase[ConfigT] with both _to_config and _from_config implemented as a matched pair.

Example fix

# before
class MyComponent(ComponentBase[MyConfig]):
    def _to_config(self) -> MyConfig: ...
    # no _from_config -> NotImplementedError on load

# after
class MyComponent(ComponentBase[MyConfig]):
    def _to_config(self) -> MyConfig:
        return MyConfig(x=self.x)

    @classmethod
    def _from_config(cls, config: MyConfig) -> "MyComponent":
        return cls(x=config.x)
Defensive patterns

Strategy: type-guard

Validate before calling

import inspect

if cls._from_config is ComponentBase._from_config:
    raise TypeError(f"{cls.__name__} cannot be loaded from config; implement _from_config")

Type guard

def implements_from_config(cls: type) -> bool:
    return cls._from_config is not ComponentBase._from_config

Try / catch

try:
    obj = ComponentBase.load_component(model)
except NotImplementedError as e:
    if "does not support" in str(e):
        # reconstruct manually from model.config instead
        obj = MyComponent(**model.config.model_dump())
    else:
        raise

Prevention

When it happens

Trigger: Calling ComponentBase.load_component(model) (or cls._from_config(config)) on a subclass that implements dump_component/_to_config but never overrides _from_config.

Common situations: Adding ComponentBase to an existing class for serialization of configs, forgetting the load half; version upgrades where load_component started routing through _from_config.

Related errors


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