{"record":{"id":"ba421f7f8839b99b","repo":"bevyengine/bevy","slug":"expected-a-path-to-a-bsn-type-but-encountered-a-pa-ba421f","errorCode":null,"errorMessage":"Expected a path to a BSN type but encountered a path to a const.","messagePattern":"Expected a path to a BSN type but encountered a path to a const\\.","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/bevy_scene/macros/src/bsn/parse.rs","lineNumber":356,"sourceCode":"        let mut path = input.parse::<Path>()?;\n        let enum_variant = match PathType::new(&path) {\n            PathType::Type => None,\n            PathType::Enum | PathType::TypeConst => take_last_path_ident(&mut path),\n            PathType::Function | PathType::TypeFunction => {\n                return Err(syn::Error::new(\n                    path.span(),\n                    \"Expected a path to a BSN type but encountered a path to a function.\",\n                ))\n            }\n            PathType::Const => {\n                return Err(syn::Error::new(\n                    path.span(),\n                    \"Expected a path to a BSN type but encountered a path to a const.\",\n                ))\n            }\n        };\n        let fields = input.parse::<BsnFields>()?;\n        Ok(BsnType {\n            path,\n            variant: enum_variant,\n            fields,\n        })\n    }\n}\n\nimpl Parse for BsnStructUpdate {\n    fn parse(input: ParseStream) -> Result<Self> {\n        input.parse::<Dot>()?;\n        input.parse::<Dot>()?;\n        Ok(BsnStructUpdate {\n            value: Box::new(input.parse::<BsnValue>()?),\n        })\n    }\n}\n\nimpl Parse for BsnTuple {","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/bevyengine/bevy/blob/8d743eb7dc7fcff57a7d5744d0bbf89620b1b145/crates/bevy_scene/macros/src/bsn/parse.rs#L338-L374","documentation":"Compile-time error from the bsn! macro when parsing a BsnType. The parser expected a path to a type but PathType::new classified it as a const or type-const. BSN type positions accept types (and enum variants), never consts.","triggerScenarios":"Writing a const where a BSN type is expected, most commonly right after '@', e.g. bsn! { @MY_SCENE_TYPE }. The BsnType parser parses the path, sees PathType::Const/TypeConst, and returns this error.","commonSituations":"Trying to indirect a type name through a const; uppercase naming that makes a type look like a const (PathType heuristics classify SCREAMING_CASE identifiers as consts); leftover refactoring debris.","solutions":["Use the actual type name in the BSN source: @MySceneComponent instead of a const alias","If the identifier is really a type but named in SCREAMING_CASE, rename it to CamelCase so PathType classifies it as a type","If it is genuinely a const value, move it into an expression position (field value) rather than type position"],"exampleFix":"// before\nbsn! { @MY_SCENE_TYPE }\n\n// after\nbsn! { @MySceneType }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a type name (CamelCase) after '@', not a const (SCREAMING_CASE)","Be aware PathType classification is naming-convention driven: uppercase identifiers look like consts"],"tags":["bevy","bsn","proc-macro","const","naming"],"backgroundTag":"rust-macro-parse-error","analyzedSha":"8d743eb7dc7fcff57a7d5744d0bbf89620b1b145","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}