apache/beam · error · ValueError
Invalid model update, path for
Error message
Invalid model update, path for {keys} is empty What it means
Raised by KeyedModelHandler.update_model_paths when an UpdateDawgModelPath (or similar update spec) has an empty update_path. Every model key submitted for a hot model update must carry a non-empty new model path so the handler can locate the updated model artifacts.
Solutions
- Set a non-empty update_path for every update object passed to update_model_paths.
- Validate the update list before calling: skip or fix entries with len(update_path) == 0.
- Check the config/templating source to ensure the path field is populated, not an empty default.
Example fix
// before update = UpdateModelPath(keys=['cohort-a'], update_path='', model_id='m2') handler.update_model_paths([update]) // after update = UpdateModelPath(keys=['cohort-a'], update_path='gs://bucket/model_v2', model_id='m2') handler.update_model_paths([update])
Defensive patterns
Strategy: validation
Validate before calling
bad = [u for u in updates if not u.update_path]
if bad:
raise ValueError(f'update_path missing for keys: {[u.keys for u in bad]}') Type guard
def has_update_path(u) -> bool:
return isinstance(u.update_path, str) and len(u.update_path) > 0 Prevention
- Validate update objects at config-load time, before constructing update requests.
- Avoid empty-string defaults for path fields in update configs.
When it happens
Trigger: Calling update_model_paths with a list of update objects where one has update_path set to '' (empty string), or constructing the update object without setting the path field.
Common situations: Building model update requests programmatically from config where a path key is missing or defaults to empty string; YAML/JSON update configs with a blank 'update_path' field; templating failures that silently drop the path value.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Invalid model update: sent many model paths to update, but…
- Cannot make make an unkeyed model handler with pre or…
- Cannot override RemoteModelHandler.load_model, implement…
- Cannot override RemoteModelHandler.run_inference, implement…
- Cannot use an unkeyed model handler with pre or…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/de533f482fd2f03c.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/ml/inference/base.py:975
# Map cohort ids to a dictionary mapping new model paths to the keys that
# were originally in that cohort. We will use this to construct our new
# cohorts.
# cohort_path_mapping will be structured as follows:
# {
# original_cohort_id: {
# 'update/path/1': ['key1FromOriginalCohort', key2FromOriginalCohort'],
# 'update/path/2': ['key3FromOriginalCohort', key4FromOriginalCohort'],
# }
# }
cohort_path_mapping: dict[KeyT, dict[str, list[KeyT]]] = {}
key_modelid_mapping: dict[KeyT, str] = {}
seen_keys = set()
for mp in model_paths:
keys = mp.keys
update_path = mp.update_path
model_id = mp.model_id
if len(update_path) == 0:
raise ValueError(f'Invalid model update, path for {keys} is empty')
for key in keys:
if key in seen_keys:
raise ValueError(
f'Invalid model update: {key} appears in multiple '
'update lists. A single model update must provide exactly one '
'updated path per key.')
seen_keys.add(key)
if key not in self._key_to_id_map:
raise ValueError(
f'Invalid model update: {key} appears in '
'update, but not in the original configuration.')
key_modelid_mapping[key] = model_id
cohort_id = self._key_to_id_map[key]
if cohort_id not in cohort_path_mapping:
cohort_path_mapping[cohort_id] = defaultdict(list)
cohort_path_mapping[cohort_id][update_path].append(key)
for key in self._key_to_id_map:
if key not in seen_keys:View on GitHub (pinned to 12126d8942)