{"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":303,"sourceCode":"impl BsnScene {\n    fn parse(input: ParseStream) -> Result<Self> {\n        Ok(if input.peek(LitStr) {\n            let path = input.parse::<LitStr>()?;\n            BsnScene::Asset(path)\n        } else if input.peek(Brace) {\n            BsnScene::Expression(braced_tokens(input)?)\n        } else {\n            // PERF: do we really need this fork here?\n            let path = input.fork().parse::<Path>()?;\n            let path_type = PathType::new(&path);\n            match path_type {\n                PathType::Type | PathType::Enum => {\n                    BsnScene::SceneComponent(input.parse::<BsnType>()?)\n                }\n                PathType::Function | PathType::TypeFunction => {\n                    let path = input.parse::<Path>()?;\n                    if path_type == PathType::Function\n                        && path.segments.len() == 1\n                        && !input.peek(Paren)\n                    {\n                        BsnScene::Expression(path.to_token_stream())\n                    } else {\n                        let args = input.parse::<BsnFnArgs>()?;\n                        BsnScene::Fn(BsnSceneFn { path, args })\n                    }\n                }\n                path_type => {\n                    return Err(syn::Error::new(\n                        path.span(),\n                        format!(\n                            \"Scenes with path {} of type {:?} are not supported\",\n                            path_to_string(&path),\n                            path_type,\n                        ),\n                    ))\n                }","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/bevyengine/bevy/blob/a62cce8c05ceacd3bd102e678c83e2b42e5dfbe2/crates/bevy_scene/macros/src/bsn/parse.rs#L285-L321","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":"a62cce8c05ceacd3bd102e678c83e2b42e5dfbe2","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}