keras-team/keras · error · ValueError

No endpoints have been set yet. Call add_endpoint().

Error message

No endpoints have been set yet. Call add_endpoint().

What it means

State precondition check in write_out(): a SavedModel artifact must contain at least one serving endpoint before it can be serialized, and this export archive has none registered yet, so there is nothing valid to write.

Solutions

  1. Call export_archive.add_endpoint(name=..., fn=..., input_signature=...) at least once before write_out()
  2. Verify an earlier add_endpoint() call actually executed and wasn't skipped by an early return or exception
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at keras/src/export/saved_model_export_archive.py:266 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/fad5e563226b2e10. Report an issue: GitHub.

Appendix: source

Thrown at keras/src/export/saved_model_export_archive.py:266

        Arguments:
            filepath: `str` or `pathlib.Path` object.
                Path where to save the artifact.
            options: `tf.saved_model.SaveOptions` object that specifies
                SavedModel saving options.
            verbose: whether to print all the variables of an
                exported SavedModel.

        **Note on TF-Serving**: all endpoints registered via `add_endpoint()`
        are made visible for TF-Serving in the SavedModel artifact. In addition,
        the first endpoint registered is made visible under the alias
        `"serving_default"` (unless an endpoint with the name
        `"serving_default"` was already registered manually),
        since TF-Serving requires this endpoint to be set.
        """
        from keras.src.utils import io_utils

        if not self._endpoint_names:
            raise ValueError(
                "No endpoints have been set yet. Call add_endpoint()."
            )
        self._filter_and_track_resources()

        signatures = {}
        for name in self._endpoint_names:
            signatures[name] = self._get_concrete_fn(name)
        # Add "serving_default" signature key for TFServing
        if "serving_default" not in self._endpoint_names:
            signatures["serving_default"] = self._get_concrete_fn(
                self._endpoint_names[0]
            )

        tf.saved_model.save(
            self._tf_trackable,
            filepath,
            options=options,
            signatures=signatures,

View on GitHub (pinned to 7a34a03db6)