keras-team/keras · error · ValueError

Invalid value for argument `output_mode`. Expected one of {'

Error message

Invalid value for argument `output_mode`. Expected one of {'int', 'one_hot', 'float'}. Received: output_mode={output_mode}

What it means

Error "Invalid value for argument `output_mode`. Expected one of {'int', 'one_hot', 'float'}. Received: output_mode={output_mode}" thrown in keras-team/keras.

Source

Thrown at keras/src/layers/preprocessing/feature_space.py:52

    def name(self):
        return "_X_".join(self.feature_names)

    def get_config(self):
        return {
            "feature_names": self.feature_names,
            "crossing_dim": self.crossing_dim,
            "output_mode": self.output_mode,
        }

    @classmethod
    def from_config(cls, config):
        return cls(**config)


class Feature(KerasSaveable):
    def __init__(self, dtype, preprocessor, output_mode):
        if output_mode not in {"int", "one_hot", "float"}:
            raise ValueError(
                "Invalid value for argument `output_mode`. "
                "Expected one of {'int', 'one_hot', 'float'}. "
                f"Received: output_mode={output_mode}"
            )
        self.dtype = dtype
        if isinstance(preprocessor, dict):
            preprocessor = serialization_lib.deserialize_keras_object(
                preprocessor
            )
        self.preprocessor = preprocessor
        self.output_mode = output_mode

    def _obj_type(self):
        return "Feature"

    def get_config(self):
        return {
            "dtype": self.dtype,

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/layers/preprocessing/feature_space.py:52 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/cd3d6112be888492. Report an issue: GitHub.