bevyengine/bevy · error
A Relationship Target already has its own clone behavior, pl
Error message
A Relationship Target already has its own clone behavior, please remove `clone_behavior = ...`
What it means
Compile-time error from ComponentAttributes::parse: the type derives RelationshipTarget (whose clone behavior is fixed by the derive) while also specifying #[component(clone_behavior = ...)], which would conflict with the generated relationship-target clone logic.
Source
Thrown at crates/bevy_ecs/macro_logic/src/component.rs:163
));
}
}
if let Some(current) = &mut attrs.requires {
current.extend(punctuated);
} else {
attrs.requires = Some(punctuated);
}
} else if attr.path().is_ident(RELATIONSHIP) {
let relationship = attr.parse_args::<Relationship>()?;
attrs.relationship = Some(relationship);
} else if attr.path().is_ident(RELATIONSHIP_TARGET) {
let relationship_target = attr.parse_args::<RelationshipTarget>()?;
attrs.relationship_target = Some(relationship_target);
}
}
if attrs.relationship_target.is_some() && attrs.clone_behavior.is_some() {
return Err(syn::Error::new(
attrs.clone_behavior.span(),
"A Relationship Target already has its own clone behavior, please remove `clone_behavior = ...`",
));
}
if attrs.summary_tick && matches!(attrs.storage, Some(StorageTy::SparseSet)) {
return Err(syn::Error::new(
ast.span(),
"Summary ticks are only supported for components with table storage.",
));
}
Ok(attrs)
}
/// Generates a new `Component` trait implementation from this specification.
///
/// Note that this will add Send + Sync + 'static to the where clauseView on GitHub (pinned to 396ca72708)
Solutions
- Remove the clone_behavior attribute from the RelationshipTarget derive
- Implement clone behavior indirectly if truly needed, without conflicting with the derive
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_ecs/macro_logic/src/component.rs:163 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20).
Data as JSON: /api/errors/179a6557e5cf24d7.
Report an issue: GitHub.