{"record":{"id":"57b8fb1f85a7a67f","repo":"keras-team/keras","slug":"the-provided-configuration-is-not-a-valid-keras-co","errorCode":null,"errorMessage":"The provided configuration is not a valid Keras configuration. Expected a dictionary containing a 'config' key. Received: config={config}","messagePattern":"The provided configuration is not a valid Keras configuration\\. Expected a dictionary containing a 'config' key\\. Received: config=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/legacy/saving/saving_utils.py","lineNumber":58,"sourceCode":"            \"`model_from_config` expects a dictionary, not a list. \"\n            f\"Received: config={config}. Did you meant to use \"\n            \"`Sequential.from_config(config)`?\"\n        )\n\n    global MODULE_OBJECTS\n\n    if not hasattr(MODULE_OBJECTS, \"ALL_OBJECTS\"):\n        from keras.src import layers\n        from keras.src import models\n\n        MODULE_OBJECTS.ALL_OBJECTS = layers.__dict__\n        MODULE_OBJECTS.ALL_OBJECTS[\"InputLayer\"] = layers.InputLayer\n        MODULE_OBJECTS.ALL_OBJECTS[\"Functional\"] = models.Functional\n        MODULE_OBJECTS.ALL_OBJECTS[\"Model\"] = models.Model\n        MODULE_OBJECTS.ALL_OBJECTS[\"Sequential\"] = models.Sequential\n\n    if not isinstance(config, dict) or \"config\" not in config:\n        raise ValueError(\n            \"The provided configuration is not a valid Keras configuration. \"\n            \"Expected a dictionary containing a 'config' key. \"\n            f\"Received: config={config}\"\n        )\n    batch_input_shape = config[\"config\"].pop(\"batch_input_shape\", None)\n    if batch_input_shape is not None:\n        if config[\"class_name\"] == \"InputLayer\":\n            config[\"config\"][\"batch_shape\"] = batch_input_shape\n        else:\n            config[\"config\"][\"input_shape\"] = batch_input_shape\n\n    axis = config[\"config\"].pop(\"axis\", None)\n    if axis is not None:\n        if isinstance(axis, list) and len(axis) == 1:\n            config[\"config\"][\"axis\"] = int(axis[0])\n        elif isinstance(axis, (int, float)):\n            config[\"config\"][\"axis\"] = int(axis)\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/legacy/saving/saving_utils.py#L40-L76","documentation":"Raised when deserializing a model from a config dict that lacks the nested 'config' key expected by the Keras serialization format (which uses {'class_name': ..., 'config': {...}}). The function tries to read config['config'] to reconstruct the model, so a malformed or foreign dictionary aborts with this guard before the lookup fails obscurely.","triggerScenarios":"Thrown at keras/src/legacy/saving/saving_utils.py:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the full serialized form {'class_name': ..., 'config': model.get_config()} as produced by keras.models.model_to_json or serialize_keras_object","If you only have get_config() output, pass it via the appropriate from_config classmethod instead of this function"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}