keras-team/keras · error · ValueError
Missing data for input "{name}". You passed a data dictionar
Error message
Missing data for input "{name}". You passed a data dictionary with keys {list(inputs.keys())}. Expected the following keys: {names} What it means
Error "Missing data for input "{name}". You passed a data dictionary with keys {list(inputs.keys())}. Expected the following keys: {names}" thrown in keras-team/keras.
Source
Thrown at keras/src/layers/input_spec.py:150
input tensors.
layer_name: String, name of the layer (for error message formatting).
Raises:
ValueError: in case of mismatch between
the provided inputs and the expectations of the layer.
"""
if not input_spec:
return
input_spec = tree.flatten(input_spec)
if isinstance(inputs, dict):
# Flatten `inputs` by reference order if input spec names are provided
names = [spec.name for spec in input_spec]
if all(names):
list_inputs = []
for name in names:
if name not in inputs:
raise ValueError(
f'Missing data for input "{name}". '
"You passed a data dictionary with keys "
f"{list(inputs.keys())}. "
f"Expected the following keys: {names}"
)
list_inputs.append(inputs[name])
inputs = list_inputs
inputs = tree.flatten(inputs)
if len(inputs) != len(input_spec):
# Provide appropriate error message for dict inputs.
spec_names = [spec.name for spec in input_spec if spec is not None]
if len(spec_names) == len(input_spec) and all(spec_names):
raise ValueError(
f'Layer "{layer_name}" expects {len(input_spec)} named '
f"input(s) with keys {spec_names}, but it received "
f"{len(inputs)} input tensors. Pass inputs as a dict, e.g. "
"`layer({"View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/layers/input_spec.py:150 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/1b5ac244d2c591d8.
Report an issue: GitHub.