{"record":{"id":"09ff83a6abdacd8c","repo":"keras-team/keras","slug":"hashedcrossing-should-be-called-on-at-least-two","errorCode":null,"errorMessage":"`HashedCrossing` should be called on at least two inputs. Received: inputs={inputs}","messagePattern":"`HashedCrossing` should be called on at least two inputs\\. Received: inputs=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/preprocessing/hashed_crossing.py","lineNumber":196,"sourceCode":"            return backend_utils.convert_tf_tensor(outputs, dtype=self.dtype)\n\n    def get_config(self):\n        return {\n            \"num_bins\": self.num_bins,\n            \"output_mode\": self.output_mode,\n            \"sparse\": self.sparse,\n            \"name\": self.name,\n            \"dtype\": self.dtype,\n        }\n\n    def _check_at_least_two_inputs(self, inputs):\n        if not isinstance(inputs, (list, tuple)):\n            raise ValueError(\n                \"`HashedCrossing` should be called on a list or tuple of \"\n                f\"inputs. Received: inputs={inputs}\"\n            )\n        if len(inputs) < 2:\n            raise ValueError(\n                \"`HashedCrossing` should be called on at least two inputs. \"\n                f\"Received: inputs={inputs}\"\n            )\n\n    def _check_input_shape_and_type(self, inputs):\n        first_shape = tuple(inputs[0].shape)\n        rank = len(first_shape)\n        if rank > 2 or (rank == 2 and first_shape[-1] != 1):\n            raise ValueError(\n                \"All `HashedCrossing` inputs should have shape `()`, \"\n                \"`(batch_size)` or `(batch_size, 1)`. \"\n                f\"Received: inputs={inputs}\"\n            )\n        if not all(tuple(x.shape) == first_shape for x in inputs[1:]):\n            raise ValueError(\n                \"All `HashedCrossing` inputs should have equal shape. \"\n                f\"Received: inputs={inputs}\"\n            )","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/preprocessing/hashed_crossing.py#L178-L214","documentation":"A crossing by definition needs at least two inputs; call() rejects lists with fewer than two elements.","triggerScenarios":"layer([x]) — a one-element list — reaching _check_at_least_two_inputs during call().","commonSituations":"Passing a one-element list [x]; building a pipeline before the second feature is connected; copy-paste from a single-input layer.","solutions":["Provide at least two tensors: layer([x, y])","If you only have one feature, use layers.Hashing instead of HashedCrossing"],"exampleFix":"// before\nout = layer([x])\n// after\nout = layer([x, y])","handlingStrategy":"validation","validationCode":"assert len(inputs) >= 2, \"HashedCrossing needs >= 2 inputs\"","typeGuard":"def has_two_inputs(inputs):\n    return isinstance(inputs, (list, tuple)) and len(inputs) >= 2","tryCatchPattern":"catch ValueError from call() and either add a second input tensor or replace the layer with Hashing","preventionTips":["Always supply at least two inputs to HashedCrossing","A single input cannot be crossed; use Hashing or a lookup layer instead"],"tags":["keras","hashed-crossing","input-count"],"backgroundTag":"invalid-input-type","analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}