{"record":{"id":"927f78966cc07cb6","repo":"bevyengine/bevy","slug":"cannot-cache-scene-components-with-props-fields","errorCode":null,"errorMessage":"Cannot cache Scene Components with props/fields","messagePattern":"Cannot cache Scene Components with props/fields","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/bevy_scene/macros/src/bsn/parse.rs","lineNumber":293,"sourceCode":"    fn parse(input: ParseStream) -> Result<Self> {\n        Ok(if input.peek(Brace) {\n            let tokens = braced_tokens(input)?;\n            BsnSceneListItem::Expression(tokens)\n        } else {\n            BsnSceneListItem::Scene(input.parse::<Bsn>()?)\n        })\n    }\n}\n\nimpl 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                }","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/bevyengine/bevy/blob/a62cce8c05ceacd3bd102e678c83e2b42e5dfbe2/crates/bevy_scene/macros/src/bsn/parse.rs#L275-L311","documentation":"The @-prefixed scene-component form (@MySceneComponent) parses a BsnType; if it has fields/props, err_if_cached rejects it under a ':' cache prefix — only fieldless scene components are cacheable in principle. As with the expression case, the earlier 'caching is only supported for scene assets' check (parse.rs:229-231) intercepts ':' + non-literal first today, so this message is the guard kept for when asset-only caching is relaxed.","triggerScenarios":"Writing :@MySceneComponent { field: value } — a cached scene component that carries fields (currently surfaced as the 'only scene assets' error due to the earlier check).","commonSituations":"Marking data-rich scene components as cached; assuming ':' works uniformly across all BSN scene forms.","solutions":["Remove the ':' prefix from the scene component: @MySceneComponent { field: value }","If you need caching, put the content in a scene asset and load it with :\"path.scene\" instead"],"exampleFix":"// before\nbsn!(:@MySceneComponent { speed: 10.0 });\n\n// after\nbsn!(@MySceneComponent { speed: 10.0 });","handlingStrategy":"validation","validationCode":"// Rule: @SceneComponent forms take no ':' prefix; if the component has\n// fields, caching is not an option at all today.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write @SceneComponent entries without the ':' prefix","Fieldless or not, prefer scene assets (\":\"path\") when caching behavior is required"],"tags":["bevy","bsn","proc-macro","scene-component","compile-error"],"backgroundTag":"proc-macro-syntax-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"}