keras-team/keras · error · ValueError
Unknown {printable_module_name}: '{class_name}'. Please ensu
Error message
Unknown {printable_module_name}: '{class_name}'. Please ensure you are using a `keras.utils.custom_object_scope` and that this object is included in the scope. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details. What it means
Error "Unknown {printable_module_name}: '{class_name}'. Please ensure you are using a `keras.utils.custom_object_scope` and that this object is included in the scope. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details." thrown in keras-team/keras.
Source
Thrown at keras/src/legacy/saving/serialization.py:353
):
"""Returns the class name and config for a serialized keras object."""
if (
not isinstance(config, dict)
or "class_name" not in config
or "config" not in config
):
raise ValueError(
f"Improper config format for {config}. "
"Expecting python dict contains `class_name` and `config` as keys"
)
class_name = config["class_name"]
cls = object_registration.get_registered_object(
class_name, custom_objects, module_objects
)
if cls is None:
raise ValueError(
f"Unknown {printable_module_name}: '{class_name}'. "
"Please ensure you are using a `keras.utils.custom_object_scope` "
"and that this object is included in the scope. See "
"https://www.tensorflow.org/guide/keras/save_and_serialize"
"#registering_the_custom_object for details."
)
cls_config = config["config"]
# Check if `cls_config` is a list. If it is a list, return the class and the
# associated class configs for recursively deserialization. This case will
# happen on the old version of sequential model (e.g. `keras_version` ==
# "2.0.6"), which is serialized in a different structure, for example
# "{'class_name': 'Sequential',
# 'config': [{'class_name': 'Embedding', 'config': ...}, {}, ...]}".
if isinstance(cls_config, list):
return (cls, cls_config)
deserialized_objects = {}View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/legacy/saving/serialization.py:353 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/382ee8163b61bd3e.
Report an issue: GitHub.