{"record":{"id":"9ea66615cfc009c1","repo":"keras-team/keras","slug":"unable-to-revive-model-from-config-when-overridin","errorCode":null,"errorMessage":"Unable to revive model from config. When overriding the `get_config()` method, make sure that the returned config contains all items used as arguments in the  constructor to {cls}, which is the default behavior. You can override this default behavior by defining a `from_config(cls, config)` class method to specify how to create an instance of {cls.__name__} from its config.\n\nReceived config={config}\n\nError encountered during deserialization: {e}","messagePattern":"Unable to revive model from config\\. When overriding the `get_config\\(\\)` method, make sure that the returned config contains all items used as arguments in the  constructor to (.+?), which is the default behavior\\. You can override this default behavior by defining a `from_config\\(cls, config\\)` class method to specify how to create an instance of (.+?) from its config\\.\n\nReceived config=(.+?)\n\nError encountered during deserialization: (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"keras/src/models/model.py","lineNumber":1041,"sourceCode":"            # Revive Functional model\n            # (but not Functional subclasses with a custom __init__)\n            from keras.src.models.functional import functional_from_config\n\n            return functional_from_config(\n                cls, config, custom_objects=custom_objects\n            )\n\n        # Either the model has a custom __init__, or the config\n        # does not contain all the information necessary to\n        # revive a Functional model. This happens when the user creates\n        # subclassed models where `get_config()` is returning\n        # insufficient information to be considered a Functional model.\n        # In this case, we fall back to provide all config into the\n        # constructor of the class.\n        try:\n            return cls(**config)\n        except TypeError as e:\n            raise TypeError(\n                \"Unable to revive model from config. When overriding \"\n                \"the `get_config()` method, make sure that the \"\n                \"returned config contains all items used as arguments \"\n                f\"in the  constructor to {cls}, \"\n                \"which is the default behavior. \"\n                \"You can override this default behavior by defining a \"\n                \"`from_config(cls, config)` class method to specify \"\n                \"how to create an \"\n                f\"instance of {cls.__name__} from its config.\\n\\n\"\n                f\"Received config={config}\\n\\n\"\n                f\"Error encountered during deserialization: {e}\"\n            )\n\n    def _get_variable_map(self):\n        store = {}\n        map_saveable_variables(self, store=store, visited_saveables=set())\n        return store\n","sourceCodeStart":1023,"sourceCodeEnd":1059,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/models/model.py#L1023-L1059","documentation":"Error \"Unable to revive model from config. When overriding the `get_config()` method, make sure that the returned config contains all items used as arguments in the  constructor to {cls}, which is the default behavior. You can override this default behavior by defining a `from_config(cls, config)` class method to specify how to create an instance of {cls.__name__} from its config.\n\nReceived config={config}\n\nError encountered during deserialization: {e}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/models/model.py:1041 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}