{"record":{"id":"070938eca925d204","repo":"neon-bindings/neon","slug":"expected-class-in-export-attribute","errorCode":null,"errorMessage":"Expected 'class' in export attribute","messagePattern":"Expected 'class' in export attribute","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/neon-macros/src/export/class/meta.rs","lineNumber":17,"sourceCode":"use syn::parse::{Parse, ParseStream};\n\n/// Metadata for class exports\n#[derive(Default)]\npub(crate) struct Meta {\n    /// Name for the JavaScript class itself (used in class definition)\n    pub class_name: Option<String>,\n    /// Name for the module export binding\n    pub export_name: Option<String>,\n}\n\nimpl Parse for Meta {\n    fn parse(input: ParseStream) -> syn::Result<Self> {\n        // Parse \"class\" token\n        let class_token: syn::Ident = input.parse()?;\n        if class_token != \"class\" {\n            return Err(syn::Error::new(\n                class_token.span(),\n                \"Expected 'class' in export attribute\",\n            ));\n        }\n\n        let mut meta = Meta::default();\n\n        // Check for parenthesized attributes: class(name = \"...\")\n        if input.peek(syn::token::Paren) {\n            let content;\n            syn::parenthesized!(content in input);\n\n            // Parse attributes inside parentheses\n            while !content.is_empty() {\n                let name_token: syn::Ident = content.parse()?;\n\n                match name_token.to_string().as_str() {\n                    \"name\" => {","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/neon-bindings/neon/blob/38960e4381d9ad13b551cdf2d261f609167c9bc2/crates/neon-macros/src/export/class/meta.rs#L1-L35","documentation":"The Meta parser for the #[neon] export attribute expects the literal identifier `class` as the first token of the attribute. Any other identifier (e.g. `module`, `fn`, or a typo like `clas`) is rejected with this error at the token's span.","triggerScenarios":"Writing an attribute other than `class` after #[neon], e.g. `#[neon(module)]` where only class export meta is parsed, or misspelling `class`.","commonSituations":"Copy-pasted attribute syntax from other macro systems; confusion between #[neon::main], #[neon(class)], and module exports; typos like `#[neon(cls)]`.","solutions":["Use exactly `#[neon(class)]` for class exports","Check the neon version's documented attribute syntax and correct the token spelling","Remove the attribute entirely if a different neon entry point (e.g. main) was intended"],"exampleFix":"// before\n#[neon(modlue)]\nimpl Greet { ... }\n// after\n#[neon(class)]\nimpl Greet { ... }","handlingStrategy":"validation","validationCode":"// verify the attribute token before applying\nconst EXPECTED_ATTR: &str = \"class\";\nfn check_attr(attr: &str) -> bool { attr.trim() == EXPECTED_ATTR }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the exact documented attribute `#[neon(class)]`","Double-check attribute spelling when copying examples","Consult the neon docs for the correct entry-point attributes per version"],"tags":["rust","proc-macro","neon","attribute-syntax","compile-time"],"backgroundTag":"invalid-argument-format","analyzedSha":"38960e4381d9ad13b551cdf2d261f609167c9bc2","analyzedAt":"2026-09-13T09:05:33.640Z","contentChangedAt":"2026-09-13T09:05:33.640Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}