keras-team/keras · error · ValueError
The endpoint '{call_endpoint}' is neither an attribute of th
Error message
The endpoint '{call_endpoint}' is neither an attribute of the reloaded SavedModel, nor an entry in the `signatures` field of the reloaded SavedModel. Select another endpoint via the `call_endpoint` argument. Available endpoints for this SavedModel: {list(self._reloaded_obj.signatures.keys())} What it means
TFSMLayer resolves call_endpoint by first checking attributes of the reloaded SavedModel, then its signatures dict; if neither contains the requested name it raises this ValueError listing the actually available endpoints. The endpoint name must exactly match an attribute of the loaded object or a key in reloaded.signatures. Typos, wrong casing, and endpoints that were never exported all fail here.
Source
Thrown at keras/src/export/tfsm_layer.py:81
# Initialize an empty layer, then add_weight() etc. as needed.
super().__init__(trainable=trainable, name=name, dtype=dtype)
self._reloaded_obj = tf.saved_model.load(filepath)
self.filepath = filepath
self.call_endpoint = call_endpoint
self.call_training_endpoint = call_training_endpoint
# Resolve the call function.
if hasattr(self._reloaded_obj, call_endpoint):
# Case 1: it's set as an attribute.
self.call_endpoint_fn = getattr(self._reloaded_obj, call_endpoint)
elif call_endpoint in self._reloaded_obj.signatures:
# Case 2: it's listed in the `signatures` field.
self.call_endpoint_fn = self._reloaded_obj.signatures[call_endpoint]
else:
raise ValueError(
f"The endpoint '{call_endpoint}' "
"is neither an attribute of the reloaded SavedModel, "
"nor an entry in the `signatures` field of "
"the reloaded SavedModel. Select another endpoint via "
"the `call_endpoint` argument. Available endpoints for "
"this SavedModel: "
f"{list(self._reloaded_obj.signatures.keys())}"
)
# Resolving the training function.
if call_training_endpoint:
if hasattr(self._reloaded_obj, call_training_endpoint):
self.call_training_endpoint_fn = getattr(
self._reloaded_obj, call_training_endpoint
)
elif call_training_endpoint in self._reloaded_obj.signatures:
self.call_training_endpoint_fn = self._reloaded_obj.signatures[
call_training_endpointView on GitHub (pinned to 7a34a03db6)
Solutions
- Read the error message: it lists the valid endpoints; use one of those names for call_endpoint.
- Inspect before loading: m = tf.saved_model.load(path); print(list(m.signatures.keys())) and dir(m) for attribute endpoints.
- Re-export with an explicit signature name and use that same name on both sides.
Example fix
# before
layer = TFSMLayer('saved_model/', call_endpoint='predict') # -> ValueError
# after
import tensorflow as tf
print(list(tf.saved_model.load('saved_model/').signatures.keys())) # e.g. ['serving_default']
layer = TFSMLayer('saved_model/', call_endpoint='serving_default') Defensive patterns
Strategy: validation
Validate before calling
import tensorflow as tf
loaded = tf.saved_model.load(path)
valid = set(loaded.signatures.keys()) | {a for a in dir(loaded) if not a.startswith('_')}
assert call_endpoint in valid, f'use one of {sorted(valid)}' Try / catch
try:
layer = TFSMLayer(path, call_endpoint=name)
except ValueError as e:
# the message lists available endpoints; parse it or surface it to the user
raise Prevention
- Print signatures.keys() once when onboarding a new SavedModel.
- Define signature names as shared constants used at both export and load time.
- Treat the error text as the source of truth for valid names.
When it happens
Trigger: keras.layers.TFSMLayer(path, call_endpoint='serve') when the model only exported 'serving_default'; using a custom signature name that was not passed to tf.saved_model.save(..., signatures={...}); passing the endpoint name of a different SavedModel version.
Common situations: Mismatch between the signature name used at export time (export_archive.add_endpoint(..., name='x')) and at load time; TF-Hub models whose only endpoint is 'serving_default'; renamed endpoints after retraining or re-export.
Related errors
- The endpoint '{call_training_endpoint}' is neither an attrib
- If using `weights="imagenet"` as true, `classes` should be 1
- The number of repeats in `EfficientNet` must be > 0. Receive
- If using `weights="imagenet"` as true, `classes` should be 1
- The number of repeats in `EfficientNetV2` must be > 0. Recei
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/4c4cb5ec9a791d02.
Report an issue: GitHub.