bevyengine/bevy · error · syn::Error
Not supported in this position, please use one of the follow
Error message
Not supported in this position, please use one of the following: - path to function - nothing to default to MapEntities implementation
What it means
Compile error from MapEntitiesAttributeKind::from_expr: the #[map_entities] attribute value was parsed as an expression that is not a plain path (e.g. a literal, call, or struct literal), so the macro rejected it with this sentinel listing the accepted forms — a function path or nothing at all.
Source
Thrown at crates/bevy_ecs/macro_logic/src/map_entities.rs:120
}
/// The type of `MapEntities` attribute.
#[derive(Debug)]
pub enum MapEntitiesAttributeKind {
/// expressions like function or struct names
///
/// structs will throw compile errors on the code generation so this is safe
Path(ExprPath),
/// When no value is specified
Default,
}
impl MapEntitiesAttributeKind {
fn from_expr(value: Expr) -> syn::Result<Self> {
match value {
Expr::Path(path) => Ok(Self::Path(path)),
// throw meaningful error on all other expressions
_ => Err(syn::Error::new(
value.span(),
[
"Not supported in this position, please use one of the following:",
"- path to function",
"- nothing to default to MapEntities implementation",
]
.join("\n"),
)),
}
}
fn to_token_stream(&self, bevy_ecs_path: &Path) -> TokenStream {
match self {
MapEntitiesAttributeKind::Path(path) => path.to_token_stream(),
MapEntitiesAttributeKind::Default => {
quote!(
<Self as #bevy_ecs_path::entity::MapEntities>::map_entities
)View on GitHub (pinned to 396ca72708)
Solutions
- Pass a plain function path: #[map_entities(my_map_fn)]
- Omit the value entirely to use the type's MapEntities impl: #[map_entities]
- Wrap the logic in a free function and reference it by name instead of an inline expression
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_ecs/macro_logic/src/map_entities.rs:120 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/e3cbdb0c37cb15ef.
Report an issue: GitHub.