bevyengine/bevy · error · syn::Error
Caching entries after the first is not supported, remove…
Error message
Caching entries after the first is not supported, remove the ':' prefix or make this the first entry.
What it means
The bsn!/bsn_list! macros (Bevy Scene Notation) parse a ':'-prefixed entry as a cached scene (BsnEntry::CachedScene). Caching is only allowed for the FIRST entry of a BSN list; when a CachedScene appears after other entries inside the parenthesized form, the parser emits this syn::Error at compile time.
Solutions
- Move the cached scene to the first position: bsn!(:"scene.glb#Scene1", ComponentA)
- Or remove the ':' prefix if caching of that asset is not needed
Example fix
// before
bsn!(
(MeshMaterial3d::<StandardMaterial>::default(), :"model.glb#Scene0")
)
// after
bsn!(
(:"model.glb#Scene0", MeshMaterial3d::<StandardMaterial>::default())
) Defensive patterns
Strategy: validation
Validate before calling
// Convention check before writing BSN: a ':'-cached entry must be entry #0. // Some editors/lints can be configured; simplest is a code-review checklist item: // ':' entries: first position only, and must be a string-literal asset path.
Prevention
- Keep the cached (':') scene asset as the first entry whenever you compose BSN lists
- Treat ':' as 'cache the whole scene root' — only one such root entry makes sense per list
- Read the macro error span: it points at the offending entry position in the source
When it happens
Trigger: Writing bsn!(ComponentA, :"scene.glb#Scene1") or any grouped entry list where a ':'-prefixed scene is not the first item.
Common situations: Composing scenes where a cached scene asset is appended after components; reordering BSN entries during refactors so the cached asset ends up first-but-one; copy-pasting entry lists.
Related errors
- Cannot cache path of type
- Cannot cache Scene Components with props/fields
- Cannot cache scene expressions
- Cannot cache Scene function with arguments
- Cannot use scene assets without caching, please add the ':'…
AI-assisted analysis of bevyengine/bevy@a62cce8c05 (2026-08-20).
Data as JSON: /api/errors/e15b7885162c7156.
Report an issue: GitHub.
Appendix: source
Thrown at crates/bevy_scene/macros/src/bsn/parse.rs:70
}
impl Parse for BsnListRoot {
fn parse(input: ParseStream) -> Result<Self> {
Ok(BsnListRoot(input.parse::<BsnSceneListItems>()?))
}
}
impl Parse for Bsn {
fn parse(input: ParseStream) -> Result<Self> {
let mut entries = Vec::new();
let mut used_parens = None;
if input.peek(Paren) {
used_parens = Some(input.span());
let content;
parenthesized![content in input];
while !content.is_empty() {
let entry = BsnEntry::parse(&content)?;
if matches!(entry, BsnEntry::CachedScene(_)) && !entries.is_empty() {
return Err(syn::Error::new(
content.span(),
"Caching entries after the first is not supported, remove the ':' prefix or make this the first entry.",
));
}
entries.push(entry);
}
} else {
while !input.is_empty() {
let entry = BsnEntry::parse(input)?;
if matches!(entry, BsnEntry::CachedScene(_)) && !entries.is_empty() {
return Err(syn::Error::new(
input.span(),
"Caching entries after the first is not supported, remove the ':' prefix or make this the first entry.",
));
}
entries.push(entry);
if input.peek(Comma) || input.peek(TwoMinus) {View on GitHub (pinned to a62cce8c05)