{"record":{"id":"ac9b9b93b6099dfc","repo":"microsoft/autogen","slug":"this-component-does-not-support-dumping-to-config","errorCode":null,"errorMessage":"This component does not support dumping to config","messagePattern":"This component does not support dumping to config","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-core/src/autogen_core/_component_config.py","lineNumber":97,"sourceCode":"        )\n        return _TRUSTED_PROVIDER_NAMESPACES + extras\n    return _TRUSTED_PROVIDER_NAMESPACES\n\n\nclass ComponentFromConfig(Generic[FromConfigT]):\n    @classmethod\n    def _from_config(cls, config: FromConfigT) -> Self:\n        \"\"\"Create a new instance of the component from a configuration object.\n\n        Args:\n            config (T): 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 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","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-core/src/autogen_core/_component_config.py#L79-L115","documentation":"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.","triggerScenarios":"Calling ComponentBase.load_component(model) (or cls._from_config(config)) on a subclass that implements dump_component/_to_config but never overrides _from_config.","commonSituations":"Adding ComponentBase to an existing class for serialization of configs, forgetting the load half; version upgrades where load_component started routing through _from_config.","solutions":["Implement _from_config(cls, config) in the subclass: return cls(**config.model_dump()) or equivalent.","If the class is only ever dumped, catch NotImplementedError and document it as dump-only.","Prefer deriving from ComponentBase[ConfigT] with both _to_config and _from_config implemented as a matched pair."],"exampleFix":"# before\nclass MyComponent(ComponentBase[MyConfig]):\n    def _to_config(self) -> MyConfig: ...\n    # no _from_config -> NotImplementedError on load\n\n# after\nclass MyComponent(ComponentBase[MyConfig]):\n    def _to_config(self) -> MyConfig:\n        return MyConfig(x=self.x)\n\n    @classmethod\n    def _from_config(cls, config: MyConfig) -> \"MyComponent\":\n        return cls(x=config.x)","handlingStrategy":"type-guard","validationCode":"import inspect\n\nif cls._from_config is ComponentBase._from_config:\n    raise TypeError(f\"{cls.__name__} cannot be loaded from config; implement _from_config\")","typeGuard":"def implements_from_config(cls: type) -> bool:\n    return cls._from_config is not ComponentBase._from_config","tryCatchPattern":"try:\n    obj = ComponentBase.load_component(model)\nexcept NotImplementedError as e:\n    if \"does not support\" in str(e):\n        # reconstruct manually from model.config instead\n        obj = MyComponent(**model.config.model_dump())\n    else:\n        raise","preventionTips":["Implement _from_config and _to_config as a pair whenever adopting the component protocol.","Add a round-trip unit test: dump_component() then load_component() must reproduce the object."],"tags":["autogen-core","component-config","not-implemented","serialization"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}