bevyengine/bevy · error · syn::Error
Caching entries after the first is not supported, remove the
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.
Source
Thrown at crates/bevy_scene/macros/src/bsn/parse.rs:68
}
}
impl Parse for BsnListRoot {
fn parse(input: ParseStream) -> Result<Self> {
Ok(BsnListRoot(input.parse::<BsnSceneListItems>()?))
}
}
impl<const ALLOW_FLAT: bool> Parse for Bsn<ALLOW_FLAT> {
fn parse(input: ParseStream) -> Result<Self> {
let mut entries = Vec::new();
if input.peek(Paren) {
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 if ALLOW_FLAT {
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) {
// Not ideal, but this anticipatory break allows us to parse non-parenthesizedView on GitHub (pinned to 396ca72708)
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
- Consts are not currently supported in this position
- Currently, caching is only supported for scene assets. Pleas
- Cannot use scene assets without caching, please add the ':'
- Cannot cache scene expressions
- Cannot cache Scene Components with props/fields
AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20).
Data as JSON: /api/errors/e15b7885162c7156.
Report an issue: GitHub.