{"record":{"id":"a04386609b4d408a","repo":"bevyengine/bevy","slug":"missing-relationship-x-attribute","errorCode":null,"errorMessage":"Missing `relationship = X` attribute","messagePattern":"Missing `relationship = X` attribute","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/macro_logic/src/component.rs","lineNumber":785,"sourceCode":"        while !input.is_empty() {\n            let lookahead = input.lookahead1();\n            if lookahead.peek(kw::linked_spawn) {\n                input.parse::<kw::linked_spawn>()?;\n                linked_spawn = true;\n            } else if lookahead.peek(kw::relationship) {\n                input.parse::<kw::relationship>()?;\n                input.parse::<Token![=]>()?;\n                relationship = Some(input.parse()?);\n            } else {\n                return Err(lookahead.error());\n            }\n            if !input.is_empty() {\n                input.parse::<Token![,]>()?;\n            }\n        }\n        Ok(RelationshipTarget {\n            relationship: relationship.ok_or_else(|| {\n                syn::Error::new(input.span(), \"Missing `relationship = X` attribute\")\n            })?,\n            linked_spawn,\n        })\n    }\n}\n\n/// Returns the field with the `#[relationship]` attribute, the only field if unnamed,\n/// or the only field in a [`Fields::Named`] with one field, otherwise `Err`.\npub(crate) fn relationship_field<'a>(\n    fields: &'a Fields,\n    derive: &'static str,\n    span: Span,\n) -> Result<&'a Field> {\n    match fields {\n        Fields::Named(fields) if fields.named.len() == 1 => Ok(fields.named.first().unwrap()),\n        Fields::Named(fields) => fields.named.iter().find(|field| {\n            field\n                .attrs","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/macro_logic/src/component.rs#L767-L803","documentation":"Compile error from parsing #[relationship] attribute options in the Relationship derive macro: after the `relationship` keyword the parser could not consume the required `= X` (the relationship-target type) or encountered an unknown option token, so syn's lookahead1 produced this generic error naming the offending input.","triggerScenarios":"Thrown at crates/bevy_ecs/macro_logic/src/component.rs:785 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Write the attribute as #[relationship = TargetType] with an explicit equals sign and type path","Check for typos in option keywords (only relationship and linked_spawn are accepted here)","Delimit multiple options with commas: #[relationship = Target, linked_spawn)]"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}