ValueError Layer sequential_20 expects 1 inputs, but it received 2 input tensors
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
This error means a Keras Sequential model was built to receive one input tensor, but the code actually passed two. The root problem is almost always a mismatch between the model architecture and the structure of the input data. To fix it, you need to decide whether the model should truly have one input or whether it should be redesigned as a multi-input model.
Why a Sequential Model Expects One Input
Sequential is designed for a straight stack of layers where one tensor flows through the model. That works well for simple pipelines such as:
This model expects exactly one input tensor of shape (batch_size, 10).
If you call it with two tensors:
Keras raises the error because the model has one input path, not two.
Common Cause: Your Data Pipeline Returns a Tuple
One frequent source of confusion is a dataset that yields (features, labels). During model.fit, that is correct because Keras knows the second tensor is the target. But if you manually call the model on the whole tuple, Keras sees two inputs.
The correct manual usage is:
not:
That second version passes both tensors to a model that expects one.
Common Cause: You Actually Have Multiple Feature Inputs
Sometimes the error is real in the sense that the data genuinely has two input branches, such as text plus metadata or image plus tabular features. In that case, Sequential is the wrong API. Use the Functional API and define multiple inputs explicitly.
Now the model is explicitly built for two input tensors, so calling it with a list of two tensors is correct.
Another Cause: Accidental Double-Wrapping
The error can also happen when code wraps an already-correct tensor structure in an extra list or tuple.
For example, if x is already a tensor, this is fine:
But if x is a tuple like (features, labels), then this is not:
And if you accidentally do:
you are definitely passing two inputs to a one-input model.
How to Debug the Structure Quickly
Inspect both the model and the input before guessing.
If you are using a dataset:
That quickly shows whether the batch is:
- a single feature tensor
- a
(features, labels)pair - a multi-input feature structure
Once you know the structure, the fix is usually obvious.
Choose Between Merging Inputs and Modeling Them Separately
If your two tensors are really just two views of the same flat feature vector, you can combine them before feeding a Sequential model.
If the two tensors represent different modalities or need different preprocessing, use the Functional API instead of forcing them into Sequential.
Common Pitfalls
The biggest mistake is passing a (features, labels) tuple directly into model(...) and forgetting that labels are not model inputs. Another is using Sequential for a true multi-input architecture. Developers also accidentally add an extra list layer around tensors, which changes the input structure without changing the tensor values. The fastest fix is usually to print the batch structure and compare it against model.inputs before rewriting anything more complicated.
Summary
- '
Sequentialmodels are built for one straight input path unless you explicitly design otherwise.' - This error means the model received two tensors when it was configured for one.
- A common cause is passing
(features, labels)directly into the model. - If you really have multiple feature inputs, switch to the Functional API.
- Inspect the batch structure before guessing at shape fixes.
- Merge tensors only when they logically belong to one combined input.

