{"record":{"id":"efebe336eb75ade6","repo":"bevyengine/bevy","slug":"cannot-use-scene-assets-without-caching-please-ad","errorCode":null,"errorMessage":"Cannot use scene assets without caching, please add the ':' prefix.","messagePattern":"Cannot use scene assets without caching, please add the ':' prefix\\.","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/bevy_scene/macros/src/bsn/parse.rs","lineNumber":236,"sourceCode":"                Err(syn::Error::new(colon.span(), msg))\n            } else {\n                Ok(())\n            }\n        };\n\n        // It may seem odd how this is checking LitStr again\n        // and how there doesn't seem to be a need for all the specific `err_if_cached`\n        // in later code. But since caching is planned, and will very likely\n        // have the limitations which are ensured by the other errors below,\n        // this is its own block so its very simple to remove once caching is implemented.\n        if !input.peek(LitStr) {\n            err_if_cached(\"Currently, caching is only supported for scene assets. Please remove the ':' prefix for now.\")?;\n        }\n\n        Ok(if input.peek(LitStr) {\n            let path = input.parse::<LitStr>()?;\n            if cached.is_none() {\n                return Err(syn::Error::new(\n                    path.span(),\n                    \"Cannot use scene assets without caching, please add the ':' prefix.\",\n                ));\n            }\n            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>()?;","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_scene/macros/src/bsn/parse.rs#L218-L254","documentation":"BsnScene::parse requires the inverse too: when the entry is a string literal (the scene-asset form, BsnScene::Asset), a ':' cache prefix MUST be present. A bare \"scene.glb#Scene0\" without ':' produces this compile-time error, because scene assets are only usable through the cached form.","triggerScenarios":"Writing bsn!(\"model.glb#Scene1\") or an entry list containing an unprefixed string-literal scene path.","commonSituations":"Muscle memory from other Bevy macros where asset paths are bare strings; upgrading projects to the BSN syntax where the ':' prefix is mandatory; forgetting the prefix when adding a scene asset entry.","solutions":["Add the ':' prefix in front of the string literal: :\"model.glb#Scene1\"","Keep the entry as the FIRST entry of the list, since cached entries may not come after other entries"],"exampleFix":"// before\nbsn!(\"model.glb#Scene1\", MyComponent);\n\n// after\nbsn!(:\"model.glb#Scene1\", MyComponent);","handlingStrategy":"validation","validationCode":"// Rule to enforce before writing BSN: every string-literal scene path\n// must be preceded by ':' (and placed first in its entry list).","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write scene assets as :\"path#SceneId\", never as bare strings","Place the cached asset entry first in the list to also satisfy the first-entry rule"],"tags":["bevy","bsn","proc-macro","scene-asset","compile-error"],"backgroundTag":"proc-macro-syntax-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"}