{"record":{"id":"05b8e94c4752e29e","repo":"keras-team/keras","slug":"layer-node-index-out-of-bounds-inbound-layer-l","errorCode":null,"errorMessage":"Layer node index out of bounds.\ninbound_layer = {layer}\ninbound_layer._inbound_nodes = {layer._inbound_nodes}\ninbound_node_index = {inbound_node_index}","messagePattern":"Layer node index out of bounds\\.\ninbound_layer = (.+?)\ninbound_layer\\._inbound_nodes = (.+?)\ninbound_node_index = (.+?)","errorType":"exception","errorClass":"IndexError","httpStatus":null,"severity":"error","filePath":"keras/src/models/functional.py","lineNumber":799,"sourceCode":"                inbound_node.output_tensors[inbound_tensor_index]\n            )\n        return [unpack_singleton(input_tensors)], kwargs\n\n    args = serialization_lib.deserialize_keras_object(node_data[\"args\"])\n    kwargs = serialization_lib.deserialize_keras_object(node_data[\"kwargs\"])\n\n    def convert_revived_tensor(x):\n        if isinstance(x, backend.KerasTensor):\n            history = x._pre_serialization_keras_history\n            if history is None:\n                return x\n            layer = created_layers.get(history[0], None)\n            if layer is None:\n                raise ValueError(f\"Unknown layer: {history[0]}\")\n            inbound_node_index = history[1]\n            inbound_tensor_index = history[2]\n            if len(layer._inbound_nodes) <= inbound_node_index:\n                raise IndexError(\n                    \"Layer node index out of bounds.\\n\"\n                    f\"inbound_layer = {layer}\\n\"\n                    f\"inbound_layer._inbound_nodes = {layer._inbound_nodes}\\n\"\n                    f\"inbound_node_index = {inbound_node_index}\"\n                )\n            inbound_node = layer._inbound_nodes[inbound_node_index]\n            return inbound_node.output_tensors[inbound_tensor_index]\n        return x\n\n    args = tree.map_structure(convert_revived_tensor, args)\n    kwargs = tree.map_structure(convert_revived_tensor, kwargs)\n    return args, kwargs\n\n\ndef is_input_keras_tensor(x):\n    (\n        operation,\n        node_index,","sourceCodeStart":781,"sourceCodeEnd":817,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/models/functional.py#L781-L817","documentation":"Raised while reviving serialized tensors: the recorded keras_history node index exceeds the number of inbound nodes the reconstructed layer actually has. This means the layer was called fewer times during reconstruction than when the model was originally built (e.g. because calls were skipped or the config was edited).","triggerScenarios":"Thrown at keras/src/models/functional.py:799 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-save the model to regenerate a consistent config","Avoid editing node indices or removing layer calls from the config","Ensure custom layers recreate all their original call invocations when deserialized"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}