keras-team/keras · error · ValueError
Invalid feature type
Error message
Invalid feature type: {feature} What it means
FeatureSpace dispatches feature preprocessing by matching the feature-type string against a fixed set of supported names ('float', 'float_normalized', 'float_rescaled', 'float_discretized', 'integer_categorical', 'string_categorical', etc.). This error means the string in your `features` dict value matched none of them — typically a misspelling or an unsupported custom type.
Solutions
- Use one of the supported feature type strings, e.g. 'float', 'float_normalized', 'float_rescaled', 'float_discretized', 'integer_categorical', 'string_categorical'
- For unsupported preprocessing, pass a custom Keras layer instance instead of a string as the feature value
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at keras/src/layers/preprocessing/feature_space.py:489 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/17af69ce2b9ee3c9.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/layers/preprocessing/feature_space.py:489
return self.float(name=name)
elif feature == "float_normalized":
return self.float_normalized(name=name)
elif feature == "float_rescaled":
return self.float_rescaled(name=name)
elif feature == "float_discretized":
return self.float_discretized(
name=name, num_bins=self.num_discretization_bins
)
elif feature == "integer_categorical":
return self.integer_categorical(name=name)
elif feature == "string_categorical":
return self.string_categorical(name=name)
elif feature == "integer_hashed":
return self.integer_hashed(self.hashing_dim, name=name)
elif feature == "string_hashed":
return self.string_hashed(self.hashing_dim, name=name)
else:
raise ValueError(f"Invalid feature type: {feature}")
def _cross_to_crosser(self, cross):
return layers.HashedCrossing(cross.crossing_dim, name=cross.name)
def _list_adaptable_preprocessors(self):
adaptable_preprocessors = []
for name in self.features.keys():
preprocessor = self.preprocessors[name]
# Special case: a Normalization layer with preset mean/variance.
# Not adaptable.
if isinstance(preprocessor, layers.Normalization):
if preprocessor.input_mean is not None:
continue
# Special case: a TextVectorization layer with provided vocabulary.
elif isinstance(preprocessor, layers.TextVectorization):
if preprocessor._has_input_vocabulary:
continue
if hasattr(preprocessor, "adapt"):View on GitHub (pinned to 7a34a03db6)