apache/beam · error · ValueError
Invalid model update
Error message
Invalid model update: {key} appears in the original configuration, but not the update. What it means
Raised by update_model_paths when a key present in the handler's original configuration is missing from the update. Every originally configured key must receive exactly one updated path, so the update must be complete.
Solutions
- Provide an update entry for every key in the original configuration.
- Enumerate the handler's configured keys and assert the update covers all of them before calling.
- If only some models changed, still supply their existing paths as the updated paths for unchanged keys.
Example fix
// before
handler.update_model_paths([UpdateModelPath(keys=['k1'], update_path='gs://b/m2', model_id='m2')]) # k2 missing
// after
handler.update_model_paths([
UpdateModelPath(keys=['k1'], update_path='gs://b/m2', model_id='m2'),
UpdateModelPath(keys=['k2'], update_path='gs://b/m1', model_id='m1')]) Defensive patterns
Strategy: validation
Validate before calling
missing = set(handler._key_to_id_map) - {k for u in updates for k in u.keys}
if missing:
raise ValueError(f'keys missing from update: {missing}') Prevention
- Treat updates as full replacements: always cover every configured key.
- Generate update lists by iterating the handler's key set, not a filtered subset.
When it happens
Trigger: Calling update_model_paths with updates covering only a subset of the keys used at handler construction (e.g. updating k1 but omitting k2 which was in the original config).
Common situations: Assuming updates are partial/partially-applicable; generating the update list from a filtered config; a cohort's update entry was dropped by an earlier validation or merge step.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- 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…
- Empty list maps to model handler
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/7528ea3b1a057489.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/ml/inference/base.py:994
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:
raise ValueError(
f'Invalid model update: {key} appears in the '
'original configuration, but not the update.')
# We now have our new set of cohorts. For each one, update our local model
# handler configuration and send the results to the ModelManager
for old_cohort_id, path_key_mapping in cohort_path_mapping.items():
for updated_path, keys in path_key_mapping.items():
cohort_id = old_cohort_id
if old_cohort_id not in keys:
# Create new cohort
cohort_id = keys[0]
for key in keys:
self._key_to_id_map[key] = cohort_id
mh = self._id_to_mh_map[old_cohort_id]
self._id_to_mh_map[cohort_id] = deepcopy(mh)
self._id_to_mh_map[cohort_id].update_model_path(updated_path)
model.update_model_handler(cohort_id, updated_path, old_cohort_id)
model_id = key_modelid_mapping[cohort_id]View on GitHub (pinned to 12126d8942)