keras-team/keras · error · ValueError
{key} already exist in the LayoutMap with value {self._layou
Error message
{key} already exist in the LayoutMap with value {self._layout_map[key]}. Please make sure to not use duplicated keys. What it means
Error "{key} already exist in the LayoutMap with value {self._layout_map[key]}. Please make sure to not use duplicated keys." thrown in keras-team/keras.
Source
Thrown at keras/src/distribution/distribution_lib.py:765
f"Path '{key}' matches multiple layout "
f"specification keys: {matching_keys}. Please make "
"sure each tensor/variable path only matches at most "
"one layout specification key in the LayoutMap."
)
elif len(matching_keys) == 1:
return self._layout_map[matching_keys[0]]
return None
def __setitem__(self, key, layout):
"""Insert TensorLayout to the LayoutMap.
Args:
key: String key for the `TensorLayout`.
layout: The `TensorLayout`. As a shortcut, tuple of string and None
are also acceptable, and will be converted to `TensorLayout`.
"""
if key in self._layout_map:
raise ValueError(
f"{key} already exist in the LayoutMap with "
f"value {self._layout_map[key]}. Please make sure to "
"not use duplicated keys."
)
if isinstance(layout, tuple):
layout = TensorLayout(axes=layout, device_mesh=None)
if not isinstance(layout, TensorLayout):
raise ValueError(
f"{layout} should be a TensorLayout type, got {type(layout)}"
)
self._maybe_populate_device_mesh(layout)
self._layout_map[key] = layout
def __delitem__(self, key):
# let the dict to handle the key missing error
return self._layout_map.pop(key)
View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/distribution/distribution_lib.py:765 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/fe86d68cf43199cc.
Report an issue: GitHub.