keras-team/keras · error · ValueError

Invalid value for argument `aggregation`. Expected one of `N

Error message

Invalid value for argument `aggregation`. Expected one of `None`, `'none'`, `'mean'`, `'sum'`, `'only_first_replica'`. Received: aggregation={aggregation}

What it means

Error "Invalid value for argument `aggregation`. Expected one of `None`, `'none'`, `'mean'`, `'sum'`, `'only_first_replica'`. Received: aggregation={aggregation}" thrown in keras-team/keras.

Source

Thrown at keras/src/backend/common/variables.py:121

        name=None,
        layout=None,
        **kwargs,
    ):
        name = name or auto_name(self.__class__.__name__)
        if not isinstance(name, str) or "/" in name:
            raise ValueError(
                "Argument `name` must be a string and "
                "cannot contain character `/`. "
                f"Received: name={name}"
            )
        if aggregation not in (
            None,
            "none",
            "mean",
            "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'`. "

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/backend/common/variables.py:121 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/d1031a102c758776. Report an issue: GitHub.