keras-team/keras · error · ValueError
Invalid value for argument `synchronization`. Expected one…
Error message
Invalid value for argument `synchronization`. Expected one of `None`, `'none'`, `'on_read'`, `'on_write'`, `'auto'`. Received: synchronization={synchronization} What it means
Raised in Variable.__init__ by the whitelist check on the synchronization argument. Only None/'none'/'on_read'/'on_write'/'auto' describe valid variable synchronization strategies; anything else fails this guard at variable construction time.
Solutions
- Set synchronization to one of None, 'none', 'on_read', 'on_write', or 'auto'
- Leave synchronization at its default ('auto') unless a specific strategy is required
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at keras/src/backend/common/variables.py:136 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/6491ce74d8bcac63.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/backend/common/variables.py:136
"sum",
"only_first_replica",
):
raise ValueError(
"Invalid value for argument `aggregation`. Expected "
"one of `None`, `'none'`, `'mean'`, `'sum'`, "
"`'only_first_replica'`. "
f"Received: aggregation={aggregation}"
)
if aggregation is None:
aggregation = "none"
if synchronization not in (
None,
"none",
"on_read",
"on_write",
"auto",
):
raise ValueError(
"Invalid value for argument `synchronization`. Expected "
"one of `None`, `'none'`, `'on_read'`, `'on_write'`, "
"`'auto'`. "
f"Received: synchronization={synchronization}"
)
if synchronization is None:
synchronization = "none"
self._name = name
parent_path = current_path()
if parent_path:
self._path = f"{parent_path}/{name}"
else:
self._path = name
self._shape = None
self._initializer = None
self._regularizer = None
self._constraint = None
self._trainable = bool(trainable)View on GitHub (pinned to 7a34a03db6)