{"record":{"id":"6ccf20f0bcb3e0f2","repo":"FyroxEngine/Fyrox","slug":"there-are-multiple-original-nodes-for-previo","errorCode":null,"errorMessage":"There are multiple original nodes for {:?}! Previous was {:?}. This can happen if a respective node was deleted.","messagePattern":"There are multiple original nodes for (.+?)! Previous was (.+?)\\. This can happen if a respective node was deleted\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"fyrox-graph/src/lib.rs","lineNumber":1472,"sourceCode":"    /// instance root. Then we must find all inheritable properties and try to remap them to instance handles.\n    fn remap_handles(&mut self, instances: &[(Handle<Self::NodeWrapper>, Resource<Self::Prefab>)]) {\n        for (instance_root, resource) in instances {\n            // Prepare old -> new handle mapping first by walking over the graph\n            // starting from instance root.\n            let mut old_new_mapping = NodeHandleMap::default();\n            let mut traverse_stack = vec![*instance_root];\n            while let Some(node_handle) = traverse_stack.pop() {\n                let Ok(node) = self.try_get_node(node_handle) else {\n                    continue;\n                };\n                if let Some(node_resource) = node.resource().as_ref() {\n                    // We're interested only in instance nodes.\n                    if node_resource == resource {\n                        let previous_mapping =\n                            old_new_mapping.insert(node.original_handle_in_resource(), node_handle);\n                        // There should be no such node.\n                        if previous_mapping.is_some() {\n                            Log::warn(format!(\n                                \"There are multiple original nodes for {:?}! Previous was {:?}. \\\n                                This can happen if a respective node was deleted.\",\n                                node_handle,\n                                node.original_handle_in_resource()\n                            ))\n                        }\n                    }\n                }\n\n                traverse_stack.extend_from_slice(node.children());\n            }\n\n            // Lastly, remap handles. We can't do this in single pass because there could\n            // be cross references.\n            for handle in old_new_mapping.inner().values() {\n                old_new_mapping.remap_inheritable_handles(\n                    self.node_mut(*handle),\n                    &[TypeId::of::<UntypedResource>()],","sourceCodeStart":1454,"sourceCodeEnd":1490,"githubUrl":"https://github.com/FyroxEngine/Fyrox/blob/76c91aad8eca488ce527b1af707be8b3b24ad72d/fyrox-graph/src/lib.rs#L1454-L1490","documentation":"In remap_handles (during copy_node of an instantiated resource), it builds a map from each instance node's original_handle_in_resource to the new node handle. If two instance nodes claim the same original handle, insert returns the previous mapping and this warning fires — the graph structure is inconsistent (usually because a node was deleted but its original handle was reused/left behind).","triggerScenarios":"copy_node -> remap_handles finds multiple instance nodes with identical original_handle_in_resource — duplicate instance nodes referencing one resource node, often after a node was deleted improperly.","commonSituations":"Deleting nodes from a resource instance without cleaning original-handle mappings; duplicated subgraphs pasted into an instance; scenes saved mid-edit in the editor with stale duplicates.","solutions":["Find the duplicated nodes (the message prints both handles) and delete the stale duplicate from the instance.","Re-instantiate the resource into a fresh graph instead of patching the corrupted instance.","If the warning appears after deletes, perform deletes through the editor so integrity is maintained and restore_integrity can run.","Inspect the saved scene file for two nodes with the same original_handle and fix it by hand as a last resort."],"exampleFix":"// before\n// scene: node A (orig 5:0) and duplicate node B (orig 5:0)\n// after\ngraph.remove_node(duplicate_handle); // remove B before copy_node/instantiation sync","handlingStrategy":"validation","validationCode":"// detect duplicate original-handle mappings before remap\nfn duplicates(instance: &SceneResourceInstance) -> HashMap<Handle<Node>, usize> {\n    let mut counts = HashMap::new();\n    for n in instance.nodes() {\n        *counts.entry(n.original_handle_in_resource()).or_insert(0) += 1;\n    }\n    counts.into_iter().filter(|(_, c)| *c > 1).collect()\n}","typeGuard":null,"tryCatchPattern":"let dup = duplicates(&instance);\nif !dup.is_empty() {\n    for (orig, count) in dup { log::warn!(\"{count} nodes claim original {orig:?}; clean up before sync\"); }\n}","preventionTips":["Delete instance nodes through editor APIs that maintain original-handle maps","Avoid copy/pasting subgraphs between resource instances","Re-instantiate corrupted instances instead of patching them","Diff saved scene files for duplicate original_handle fields after merges"],"tags":["graph","handles","duplicate","prefab"],"backgroundTag":"duplicate-original-node-mapping","analyzedSha":"76c91aad8eca488ce527b1af707be8b3b24ad72d","analyzedAt":"2026-09-10T16:04:01.633Z","contentChangedAt":"2026-09-10T16:04:01.633Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}