keras-team/keras · error · ValueError
A `Concatenate` layer should be called on a list of at least
Error message
A `Concatenate` layer should be called on a list of at least 1 input. Received: input_shape={input_shape} What it means
Concatenate.build validates that input_shape is a list containing at least one shape (each itself a tuple/list). This catches calls where the layer got a single tensor's shape or an empty list, which are invalid for concatenation.
Source
Thrown at keras/src/layers/merging/concatenate.py:47
axis: Axis along which to concatenate.
**kwargs: Standard layer keyword arguments.
Returns:
A tensor, the concatenation of the inputs alongside axis `axis`.
"""
def __init__(self, axis=-1, **kwargs):
super().__init__(**kwargs)
self.axis = axis
self.supports_masking = True
self._reshape_required = False
def build(self, input_shape):
# Used purely for shape validation.
if len(input_shape) < 1 or not isinstance(
input_shape[0], (tuple, list)
):
raise ValueError(
"A `Concatenate` layer should be called on a list of "
f"at least 1 input. Received: input_shape={input_shape}"
)
if all(shape is None for shape in input_shape):
return
reduced_inputs_shapes = [list(shape) for shape in input_shape]
reduced_inputs_shapes_copy = copy.copy(reduced_inputs_shapes)
shape_set = set()
for i in range(len(reduced_inputs_shapes_copy)):
# Convert self.axis to positive axis for each input
# in case self.axis is a negative number
concat_axis = self.axis % len(reduced_inputs_shapes_copy[i])
# Skip batch axis.
for axis, axis_value in enumerate(
reduced_inputs_shapes_copy, start=1
):
# Remove squeezable axes (axes with value of 1)View on GitHub (pinned to 7a34a03db6)
Solutions
- Pass a list of two or more tensors: Concatenate()([a, b])
- Ensure all code paths deliver at least two tensors to the concat layer
- Check that upstream conditionals/filters do not reduce the input list to one element
Example fix
# before out = layers.Concatenate()(x) # after out = layers.Concatenate()([x, y])
Defensive patterns
Strategy: validation
Validate before calling
assert isinstance(inputs, (list, tuple)) and len(inputs) >= 2, 'Concatenate needs a list of >= 2 tensors'
Type guard
def is_concat_input(inputs) -> bool:
return isinstance(inputs, (list, tuple)) and len(inputs) >= 2 Prevention
- Use explicit list literals at concat sites
- Ensure conditional branches always contribute at least two tensors
When it happens
Trigger: Calling Concatenate()(x) with one tensor; Concatenate()([]); a Functional node wiring only one branch into the concat layer.
Common situations: Conditionally adding branches so that sometimes only one reaches the concat; incorrect list nesting.
Related errors
- A `Concatenate` layer should be called on a list of inputs.
- `inputs` should be a list. Received: inputs={inputs}
- A merge layer should be called on a list of inputs. Received
- A merge layer should be called on a list of inputs. Received
- `inputs` should be a list. Received: inputs={inputs}
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/c1d14e06de0748c4.
Report an issue: GitHub.