bevyengine/bevy · error · syn::Error

Cannot use scene assets without caching, please add the ':'…

Error message

Cannot use scene assets without caching, please add the ':' prefix.

What it means

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.

Solutions

  1. Add the ':' prefix in front of the string literal: :"model.glb#Scene1"
  2. Keep the entry as the FIRST entry of the list, since cached entries may not come after other entries

Example fix

// before
bsn!("model.glb#Scene1", MyComponent);

// after
bsn!(:"model.glb#Scene1", MyComponent);
Defensive patterns

Strategy: validation

Validate before calling

// Rule to enforce before writing BSN: every string-literal scene path
// must be preceded by ':' (and placed first in its entry list).

Prevention

When it happens

Trigger: Writing bsn!("model.glb#Scene1") or an entry list containing an unprefixed string-literal scene path.

Common situations: 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.

Related errors


AI-assisted analysis of bevyengine/bevy@a62cce8c05 (2026-08-20). Data as JSON: /api/errors/efebe336eb75ade6. Report an issue: GitHub.

Appendix: source

Thrown at crates/bevy_scene/macros/src/bsn/parse.rs:227

                            BsnEntry::TemplateValue(path.into_token_stream())
                        }
                    }
                }
            }
        })
    }
}
impl Parse for BsnSceneList {
    fn parse(input: ParseStream) -> Result<Self> {
        let content;
        bracketed!(content in input);
        Ok(BsnSceneList(content.parse::<BsnSceneListItems>()?))
    }
}

impl Parse for BsnSceneListItems {
    fn parse(input: ParseStream) -> Result<Self> {
        let mut scenes = Vec::new();
        let mut commas = Vec::new();
        loop {
            if input.is_empty() {
                break;
            }
            let value = input.parse::<BsnSceneListItem>()?;
            scenes.push(value);
            if input.is_empty() {
                break;
            }

            // Try parsing without a comma or -- separator first. This makes autocomplete
            // work in more places
            if !(input.peek(Comma) || input.peek(TwoMinus)) {
                let value = input.parse::<BsnSceneListItem>()?;
                scenes.push(value);
            }

View on GitHub (pinned to a62cce8c05)