{"record":{"id":"5ff70eba41bf0b33","repo":"FyroxEngine/Fyrox","slug":"duplicate-visiting-names-detected","errorCode":null,"errorMessage":"duplicate visiting names detected!","messagePattern":"duplicate visiting names detected!","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"fyrox-core-derive/src/visit/utils.rs","lineNumber":110,"sourceCode":"                Some(new_name) => {\n                    assert!(\n                        !new_name.is_empty(),\n                        \"renaming to empty string doesn't make sense!\"\n                    );\n                    // overwrite the field name with the specified name:\n                    new_name.clone()\n                }\n                None => name,\n            };\n\n            (ident, name, field.optional)\n        })\n        .collect::<Vec<_>>();\n\n    let mut no_dup = FxHashSet::default();\n    for name in visit_args.iter().map(|(_, name, _)| name) {\n        if !no_dup.insert(name) {\n            panic!(\"duplicate visiting names detected!\");\n        }\n    }\n\n    let prefix = if is_struct { Some(quote!(self.)) } else { None };\n\n    visit_args\n        .iter()\n        .map(|(ident, name, optional)| {\n            if optional_override || *optional {\n                quote! {\n                    #prefix #ident.visit(#name, &mut region).ok();\n                }\n            } else {\n                quote! {\n                    if let Err(err) = #prefix #ident.visit(#name, &mut region) {\n                        return Err(err);\n                    }\n                }","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/FyroxEngine/Fyrox/blob/76c91aad8eca488ce527b1af707be8b3b24ad72d/fyrox-core-derive/src/visit/utils.rs#L92-L128","documentation":"The derive macro for Visit generates per-field visit calls keyed by name; it panics at macro-expansion time when two fields produce the same visiting name (e.g. duplicate #[visit(name = ...)] attributes or a name collision between renamed fields). Duplicate names would make serialization ambiguous, so it fails fast.","triggerScenarios":"Deriving Visit on a struct/enum where #[visit(name = \"...\")] attributes give two fields the same name, or field names collide after a custom rename.","commonSituations":"Copy-pasting field definitions with identical visit names; renaming a field's visit name to one already used by another field; refactoring structs after a version change of fyrox-core-derive.","solutions":["Find the two fields with the same visit name and make each #[visit(name = ...)] unique.","Remove redundant explicit name attributes so fields fall back to their Rust identifiers.","If collisions come from flattened/enums usage, adjust the prefix or nesting so names differ."],"exampleFix":"// before\n#[derive(Visit)]\nstruct S {\n    #[visit(name = \"hp\")]\n    a: f32,\n    #[visit(name = \"hp\")]\n    b: f32,\n}\n// after\n#[derive(Visit)]\nstruct S {\n    #[visit(name = \"hp_a\")]\n    a: f32,\n    #[visit(name = \"hp_b\")]\n    b: f32,\n}","handlingStrategy":"validation","validationCode":"// compile-time: ensure unique visit names in your struct definitions\n// cargo build will surface this panic during macro expansion;\n// grep your derives first:\n// grep -rn 'visit(name = ' src/ | sort | uniq -d","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid explicit #[visit(name = ...)] unless required; rely on field identifiers.","When renaming, search the whole struct for the target name first.","Run cargo check early after derive-heavy refactors."],"tags":["derive-macro","serialization","compile-time","visit"],"backgroundTag":"schema-validation-failed","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"}