{"record":{"id":"a6b4627f18bf422a","repo":"bevyengine/bevy","slug":"type-path-already-set-to","errorCode":null,"errorMessage":"`type_path` already set to {}","messagePattern":"`type_path` already set to (.+?)","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/bevy_reflect/derive/src/container_attributes.rs","lineNumber":481,"sourceCode":"        &mut self,\n        input: ParseStream,\n        trait_: ReflectTraitToImpl,\n    ) -> syn::Result<()> {\n        let pair = input.parse::<MetaNameValue>()?;\n        let extracted_bool = extract_bool(&pair.value, |lit| {\n            // Override `lit` if this is a `FromReflect` derive.\n            // This typically means a user is opting out of the default implementation\n            // from the `Reflect` derive and using the `FromReflect` derive directly instead.\n            if trait_ == ReflectTraitToImpl::TypePath {\n                LitBool::new(true, Span::call_site())\n            } else {\n                lit.clone()\n            }\n        })?;\n\n        if let Some(existing) = &self.type_path_attrs.auto_derive {\n            if existing.value() != extracted_bool.value() {\n                return Err(syn::Error::new(\n                    extracted_bool.span(),\n                    format!(\"`{TYPE_PATH_ATTR}` already set to {}\", existing.value()),\n                ));\n            }\n        } else {\n            self.type_path_attrs.auto_derive = Some(extracted_bool);\n        }\n\n        Ok(())\n    }\n\n    /// Returns true if the given reflected trait name (i.e. `ReflectDefault` for `Default`)\n    /// is registered for this type.\n    pub fn contains(&self, name: &str) -> bool {\n        self.type_data\n            .iter()\n            .any(|data| data.reflect_path().is_ident(name))\n    }","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_reflect/derive/src/container_attributes.rs#L463-L499","documentation":"`#[reflect(type_path = <bool>)]` toggles automatic `TypePath` generation by the Reflect derive. Like `from_reflect`, it can only be set once: `parse_type_path` (crates/bevy_reflect/derive/src/container_attributes.rs:462) errors with \"`type_path` already set to {previous}\" on a second, conflicting value. The `TypePath` derive/`#[reflect(TypePath)]` provenance forces `true` via the mapper override, so mixing it with `type_path = false` triggers the error.","triggerScenarios":"`#[derive(Reflect, TypePath)]` plus `#[reflect(type_path = false)]`, or two `#[reflect(...)]` lists giving different bools for `type_path`. Same-value repetition is allowed.","commonSituations":"Disabling generated TypePath (e.g. for a custom `#[type_path = \"...\"]` setup or generic workaround) while another derive or attribute still enables it; attribute lists duplicated during refactors.","solutions":["Choose one source of truth: the `TypePath` derive (true) or `#[reflect(type_path = false)]`, never both","If you disabled it to supply a custom path, make sure no `TypePath` derive remains on the type","Consolidate reflect attributes into a single list"],"exampleFix":"// before: \"`type_path` already set to false\"\n#[derive(Reflect, TypePath)]\n#[reflect(type_path = false)]\nstruct Foo;\n\n// after: keep the explicit setting, drop the conflicting derive\n#[derive(Reflect)]\n#[reflect(type_path = false)]\nimpl std::fmt::Debug for Foo { /* ... */ }","handlingStrategy":"validation","validationCode":"null","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't mix #[derive(TypePath)] (or #[reflect(TypePath)]) with #[reflect(type_path = false)]","Set each boolean toggle in exactly one place","Use `cargo expand` (or rust-analyzer expand) to inspect the final attribute set when unsure"],"tags":["bevy","reflect","derive-macro","type-path","compile-error"],"backgroundTag":"derive-macro-attribute-conflict","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}