keras-team/keras · error · ValueError

All features referenced in the `crosses` argument should be…

Error message

All features referenced in the `crosses` argument should be present in the `features` dict. Received unknown features: {cross}

What it means

Raised while FeatureSpace parses its `crosses` argument: each cross must be a tuple of feature names already declared as keys in the `features` dict. The error fires when a cross references a name that is not a key in `features`, meaning you either typo'd the feature name or forgot to declare that feature entirely.

Solutions

  1. Add the missing feature name to the `features` dict with an appropriate feature type (e.g. 'integer_categorical', 'string_categorical')
  2. Fix any typo in the cross tuple so every name matches a key in `features` exactly (names are case-sensitive)
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

        self.crosses = []
        if crosses:
            feature_set = set(features.keys())
            for cross in crosses:
                if isinstance(cross, dict):
                    cross = serialization_lib.deserialize_keras_object(cross)
                if isinstance(cross, Cross):
                    self.crosses.append(cross)
                else:
                    if not crossing_dim:
                        raise ValueError(
                            "When specifying `crosses`, the argument "
                            "`crossing_dim` "
                            "(dimensionality of the crossing space) "
                            "should be specified as well."
                        )
                    for key in cross:
                        if key not in feature_set:
                            raise ValueError(
                                "All features referenced "
                                "in the `crosses` argument "
                                "should be present in the `features` dict. "
                                f"Received unknown features: {cross}"
                            )
                    self.crosses.append(Cross(cross, crossing_dim=crossing_dim))
        self.crosses_by_name = {cross.name: cross for cross in self.crosses}

        if output_mode not in {"dict", "concat"}:
            raise ValueError(
                "Invalid value for argument `output_mode`. "
                "Expected one of {'dict', 'concat'}. "
                f"Received: output_mode={output_mode}"
            )
        self.output_mode = output_mode

        self.inputs = {
            name: self._feature_to_input(name, value)

View on GitHub (pinned to 7a34a03db6)