{"record":{"id":"282206f3905bd116","repo":"keras-team/keras","slug":"the-structure-of-inputs-doesn-t-match-the-expect","errorCode":null,"errorMessage":"The structure of `inputs` doesn't match the expected structure.\\nExpected: {model_inputs_struct}\\nReceived: inputs={inputs_struct}","messagePattern":"The structure of `inputs` doesn't match the expected structure\\.\\\\nExpected: (.+?)\\\\nReceived: inputs=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/models/functional.py","lineNumber":253,"sourceCode":"                tree.lists_to_tuples(inputs),\n                tree.lists_to_tuples(self._inputs_struct),\n            )\n        except:\n            model_inputs_struct = tree.map_structure(\n                lambda x: \"None\" if x is None else x.name,\n                self._inputs_struct,\n            )\n            inputs_struct = tree.map_structure(\n                lambda x: \"None\" if x is None else f\"Tensor(shape={x.shape})\",\n                inputs,\n            )\n            msg = (\n                \"The structure of `inputs` doesn't match the expected \"\n                f\"structure.\\nExpected: {model_inputs_struct}\\n\"\n                f\"Received: inputs={inputs_struct}\"\n            )\n            if raise_exception:\n                raise ValueError(msg)\n            warnings.warn(msg)\n\n    def _convert_inputs_to_tensors(self, flat_inputs):\n        converted = []\n        for x, input_tensor in zip(flat_inputs, self._inputs):\n            if x is None:\n                # Only enforce optional semantics when the input tensor was\n                # created by an `InputLayer`. For other kinds of tensors\n                # (e.g. tensors produced dynamically) preserve previous\n                # behavior and allow None to pass through.\n                input_layer = None\n                if (\n                    hasattr(input_tensor, \"_keras_history\")\n                    and input_tensor._keras_history\n                ):\n                    input_layer = input_tensor._keras_history.operation\n\n                if isinstance(input_layer, InputLayer):","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/models/functional.py#L235-L271","documentation":"Structural guard in Functional.__call__: the inputs passed at call time must match the nesting structure of the model's declared inputs (lists converted to tuples before comparison). This fires when, e.g., a multi-input model built from a dict or list of Inputs is called with a single tensor or a differently nested structure.","triggerScenarios":"Thrown at keras/src/models/functional.py:253 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass inputs with exactly the structure of model.input: a dict with the same keys, or a list/tuple of the same length and nesting","For a single-input model, pass the tensor directly, not wrapped in a list","Use model.input_shape / model.input as a reference for the expected structure"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}