tensorflow/models · error · ValueError
If the function_keys is a list, it must contain a single ele
Error message
If the function_keys is a list, it must contain a single element. %s
What it means
Error "If the function_keys is a list, it must contain a single element. %s" thrown in tensorflow/models.
Source
Thrown at official/core/export_base.py:137
Returns:
The savedmodel directory path.
"""
ckpt_dir_or_file = checkpoint_path
if ckpt_dir_or_file is not None and tf.io.gfile.isdir(ckpt_dir_or_file):
ckpt_dir_or_file = tf.train.latest_checkpoint(ckpt_dir_or_file)
if ckpt_dir_or_file:
if checkpoint is None:
checkpoint = tf.train.Checkpoint(model=export_module.model)
checkpoint.read(
ckpt_dir_or_file).assert_existing_objects_matched().expect_partial()
if isinstance(function_keys, list):
if len(function_keys) == 1:
function_keys = {
function_keys[0]: tf.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY
}
else:
raise ValueError(
'If the function_keys is a list, it must contain a single element. %s'
% function_keys)
signatures = export_module.get_inference_signatures(function_keys)
if timestamped:
export_dir = get_timestamped_export_dir(export_savedmodel_dir).decode(
'utf-8')
else:
export_dir = export_savedmodel_dir
tf.saved_model.save(
export_module, export_dir, signatures=signatures, options=save_options)
return export_dir
def get_timestamped_export_dir(export_dir_base):
"""Builds a path to a new subdirectory within the base directory.
Args:View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/core/export_base.py:137 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/e9b41635c1ecc5dd.
Report an issue: GitHub.