{"record":{"id":"ae60a143024d139c","repo":"keras-team/keras","slug":"input-input-index-with-name-spec-name-of-lay-ae60a1","errorCode":null,"errorMessage":"Input {input_index} with name '{spec.name}' of layer '{layer_name}' is incompatible with the layer: expected max_ndim={spec.max_ndim}, found ndim={ndim}","messagePattern":"Input (.+?) with name '(.+?)' of layer '(.+?)' is incompatible with the layer: expected max_ndim=(.+?), found ndim=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/input_spec.py","lineNumber":206,"sourceCode":"            raise ValueError(\n                f\"Inputs to a layer should be tensors. Got '{x}' \"\n                f\"(of type {type(x)}) as input for layer '{layer_name}'.\"\n            )\n\n        shape = backend.standardize_shape(x.shape)\n        ndim = len(shape)\n        # Check ndim.\n        if spec.ndim is not None and not spec.allow_last_axis_squeeze:\n            if ndim != spec.ndim:\n                raise ValueError(\n                    f\"Input {input_index} with name '{spec.name}' of layer \"\n                    f\"'{layer_name}' is incompatible with the layer: \"\n                    f\"expected ndim={spec.ndim}, found ndim={ndim}. \"\n                    f\"Full shape received: {shape}\"\n                )\n        if spec.max_ndim is not None:\n            if ndim is not None and ndim > spec.max_ndim:\n                raise ValueError(\n                    f\"Input {input_index} with name '{spec.name}' of layer \"\n                    f\"'{layer_name}' is incompatible with the layer: \"\n                    f\"expected max_ndim={spec.max_ndim}, \"\n                    f\"found ndim={ndim}\"\n                )\n        if spec.min_ndim is not None:\n            if ndim is not None and ndim < spec.min_ndim:\n                raise ValueError(\n                    f\"Input {input_index} with name '{spec.name}' of layer \"\n                    f\"'{layer_name}' is incompatible with the layer: \"\n                    f\"expected min_ndim={spec.min_ndim}, \"\n                    f\"found ndim={ndim}. \"\n                    f\"Full shape received: {shape}\"\n                )\n        # Check dtype.\n        if spec.dtype is not None:\n            dtype = backend.standardize_dtype(x.dtype)\n            if dtype != spec.dtype:","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/input_spec.py#L188-L224","documentation":"Error \"Input {input_index} with name '{spec.name}' of layer '{layer_name}' is incompatible with the layer: expected max_ndim={spec.max_ndim}, found ndim={ndim}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/input_spec.py:206 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}