{"record":{"id":"040196c37b157c99","repo":"keras-team/keras","slug":"improper-config-format-for-config-expecting-pyt","errorCode":null,"errorMessage":"Improper config format for {config}. Expecting python dict contains `class_name` and `config` as keys","messagePattern":"Improper config format for (.+?)\\. Expecting python dict contains `class_name` and `config` as keys","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/legacy/saving/serialization.py","lineNumber":343,"sourceCode":"        f\"Cannot serialize {instance} because it doesn't implement \"\n        \"`get_config()`.\"\n    )\n\n\ndef class_and_config_for_serialized_keras_object(\n    config,\n    module_objects=None,\n    custom_objects=None,\n    printable_module_name=\"object\",\n):\n    \"\"\"Returns the class name and config for a serialized keras object.\"\"\"\n\n    if (\n        not isinstance(config, dict)\n        or \"class_name\" not in config\n        or \"config\" not in config\n    ):\n        raise ValueError(\n            f\"Improper config format for {config}. \"\n            \"Expecting python dict contains `class_name` and `config` as keys\"\n        )\n\n    class_name = config[\"class_name\"]\n    cls = object_registration.get_registered_object(\n        class_name, custom_objects, module_objects\n    )\n    if cls is None:\n        raise ValueError(\n            f\"Unknown {printable_module_name}: '{class_name}'. \"\n            \"Please ensure you are using a `keras.utils.custom_object_scope` \"\n            \"and that this object is included in the scope. See \"\n            \"https://www.tensorflow.org/guide/keras/save_and_serialize\"\n            \"#registering_the_custom_object for details.\"\n        )\n\n    cls_config = config[\"config\"]","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/legacy/saving/serialization.py#L325-L361","documentation":"Error \"Improper config format for {config}. Expecting python dict contains `class_name` and `config` as keys\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/legacy/saving/serialization.py:343 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"}