keras-team/keras · error · IndexError

Layer node index out of bounds.\ninbound_layer = {inbound_la

Error message

Layer node index out of bounds.\ninbound_layer = {inbound_layer}\ninbound_layer._inbound_nodes = {inbound_layer._inbound_nodes}\ninbound_node_index = {inbound_node_index}

What it means

Error "Layer node index out of bounds.\ninbound_layer = {inbound_layer}\ninbound_layer._inbound_nodes = {inbound_layer._inbound_nodes}\ninbound_node_index = {inbound_node_index}" thrown in keras-team/keras.

Source

Thrown at keras/src/models/functional.py:772

                kwargs = {}
            elif len(input_data) == 4:
                kwargs = input_data[3]
            else:
                raise ValueError(
                    "Cannot deserialize the model (invalid config data?)"
                )

            if inbound_layer_name not in created_layers:
                raise ValueError(
                    "Invalid Functional model configuration. Missing node: "
                    f"{inbound_layer_name}"
                )
            inbound_layer = created_layers[inbound_layer_name]

            # Raise an error if the corresponding layer node
            # has not yet been created
            if len(inbound_layer._inbound_nodes) <= inbound_node_index:
                raise IndexError(
                    "Layer node index out of bounds.\n"
                    f"inbound_layer = {inbound_layer}\n"
                    "inbound_layer._inbound_nodes = "
                    f"{inbound_layer._inbound_nodes}\n"
                    f"inbound_node_index = {inbound_node_index}"
                )
            inbound_node = inbound_layer._inbound_nodes[inbound_node_index]
            input_tensors.append(
                inbound_node.output_tensors[inbound_tensor_index]
            )
        return [unpack_singleton(input_tensors)], kwargs

    args = serialization_lib.deserialize_keras_object(node_data["args"])
    kwargs = serialization_lib.deserialize_keras_object(node_data["kwargs"])

    def convert_revived_tensor(x):
        if isinstance(x, backend.KerasTensor):
            history = x._pre_serialization_keras_history

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/models/functional.py:772 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/0301bccdc981d019. Report an issue: GitHub.