bevyengine/bevy · error · syn::Error
Currently, caching is only supported for scene assets. Pleas
Error message
Currently, caching is only supported for scene assets. Please remove the ':' prefix for now.
What it means
In BsnScene::parse, the ':' cache prefix is consumed first; if the next token is NOT a string literal (the scene-asset form), the parser immediately rejects it with this message. Caching is currently implemented only for scene assets (":\"path.glb\""); the source comment notes broader caching is planned and this guard block exists to be removed once real caching lands.
Source
Thrown at crates/bevy_scene/macros/src/bsn/parse.rs:230
} else {
None
};
let err_if_cached = |msg: &str| {
if let Some(colon) = cached {
Err(syn::Error::new(colon.span(), msg))
} else {
Ok(())
}
};
// It may seem odd how this is checking LitStr again
// and how there doesn't seem to be a need for all the specific `err_if_cached`
// in later code. But since caching is planned, and will very likely
// have the limitations which are ensured by the other errors below,
// this is its own block so its very simple to remove once caching is implemented.
if !input.peek(LitStr) {
err_if_cached("Currently, caching is only supported for scene assets. Please remove the ':' prefix for now.")?;
}
Ok(if input.peek(LitStr) {
let path = input.parse::<LitStr>()?;
if cached.is_none() {
return Err(syn::Error::new(
path.span(),
"Cannot use scene assets without caching, please add the ':' prefix.",
));
}
BsnScene::Asset(path)
} else if input.peek(Brace) {
err_if_cached("Cannot cache scene expressions")?;
BsnScene::Expression(braced_tokens(input)?)
} else if input.peek(At) {
input.parse::<At>()?;
let sc = input.parse::<BsnType>()?;
if sc.fields.len() > 0 {View on GitHub (pinned to 396ca72708)
Solutions
- Remove the ':' prefix — only string-literal scene assets can be cached today
- If you wanted a cached asset, make the entry a string literal: :"scene.glb#Scene0"
Example fix
// before
bsn!(:{ my_scene_expr });
// after
bsn!({ my_scene_expr }); Defensive patterns
Strategy: validation
Validate before calling
// Rule to enforce before writing BSN: ':' may only precede a string literal // scene asset path. Anything else must be written without the prefix.
Prevention
- Reserve ':' strictly for :"asset.scene" forms until broader caching ships
- Write expressions, function calls, and @components without any prefix
When it happens
Trigger: Prefixing any non-asset scene form with ':' — e.g. :{ some_expr }, :@MySceneComponent, or :some_function() — inside bsn!/bsn_list!.
Common situations: Assuming BSN caching works for inline expressions or scene components because it works for asset paths; migrating macros where ':' was used as a namespace separator; early adoption of BSN syntax while caching support is partial.
Related errors
- Caching entries after the first is not supported, remove the
- Consts are not currently supported in this position
- 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/941863a1b35936a6.
Report an issue: GitHub.