{"record":{"id":"fe8e77c369701f3a","repo":"bevyengine/bevy","slug":"scene-component-needs-to-be-prefixed-by","errorCode":null,"errorMessage":"Scene component {} needs to be prefixed by '@'","messagePattern":"Scene component (.+?) needs to be prefixed by '@'","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/bevy_scene/macros/src/bsn/parse.rs","lineNumber":259,"sourceCode":"            BsnScene::Asset(path)\n        } else if input.peek(Brace) {\n            err_if_cached(\"Cannot cache scene expressions\")?;\n            BsnScene::Expression(braced_tokens(input)?)\n        } else if input.peek(At) {\n            input.parse::<At>()?;\n            let sc = input.parse::<BsnType>()?;\n            if sc.fields.len() > 0 {\n                err_if_cached(\"Cannot cache Scene Components with props/fields\")?;\n            }\n            BsnScene::SceneComponent(sc)\n        } else {\n            // PERF: do we really need this fork here?\n            let path = input.fork().parse::<Path>()?;\n            match PathType::new(&path) {\n                PathType::Type | PathType::Enum => {\n                    // Scene components are parsed before this if an @ is found.\n                    // If this path is hit, that means it wasn't prefixed by @\n                    return Err(syn::Error::new(\n                        path.span(),\n                        format!(\n                            \"Scene component {} needs to be prefixed by '@'\",\n                            path_to_string(&path),\n                        ),\n                    ));\n                }\n                PathType::Function | PathType::TypeFunction => {\n                    let path = input.parse::<Path>()?;\n                    let args = input.parse::<BsnFnArgs>()?;\n                    if !args.0.is_empty() {\n                        err_if_cached(\"Cannot cache Scene function with arguments\")?;\n                    }\n                    BsnScene::Fn(BsnSceneFn { path, args })\n                }\n                path_type => {\n                    return Err(syn::Error::new(\n                        path.span(),","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_scene/macros/src/bsn/parse.rs#L241-L277","documentation":"This is a compile-time error from the bsn! macro's parser (bevy_scene/macros). While parsing a scene entry, the parser resolved a Rust path that refers to a type or enum, but only types preceded by '@' are accepted as scene components in scene position (e.g. inside Children [...] lists). The '@' prefix is how BSN distinguishes a scene component (a type implementing Scene) from a plain component.","triggerScenarios":"Writing a type path in scene/list position inside bsn! without the '@' prefix, e.g. bsn! { Children [MySceneComponent Score(10)] } where MySceneComponent is a type. The parser forks, parses the path, PathType::new reports Type or Enum, and since the '@' branch was not taken earlier, this error is returned.","commonSituations":"Authors learning BSN syntax who assume scene components are written like normal components; migrating code from an older bevy_scene DSL that had no '@' marker; typos where the '@' was simply forgotten.","solutions":["Prefix the scene component with '@': Children [@MySceneComponent]","If the path is meant to be a regular component (not a Scene impl), keep it without '@' but make sure it sits in component position, not in a scene list position","If the path is meant to be a scene-producing function, call it like a function (my_scene_fn()) so it parses as BsnScene::Fn"],"exampleFix":"// before\nbsn! {\n  #Player\n  Children [\n    MySceneComponent   // a type implementing Scene, missing '@'\n    Score(10)\n  ]\n}\n\n// after\nbsn! {\n  #Player\n  Children [\n    @MySceneComponent\n    Score(10)\n  ]\n}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat '@' as mandatory for scene components in scene/list position inside bsn!","Run cargo check early and often when authoring BSN — these are compile-time errors with spans pointing at the offending path","Keep a cheat sheet of BSN markers: '#' names entities, '@' marks scene components, ':' marks cached scene assets"],"tags":["bevy","bsn","proc-macro","compile-time","scene"],"backgroundTag":"rust-macro-parse-error","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"}