{"record":{"id":"6ea9a7cf75515f3c","repo":"FuelLabs/fuels-rs","slug":"expected-name-value","errorCode":null,"errorMessage":"expected name='value'","messagePattern":"expected name='value'","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fuels-macros/src/parse_utils/unique_name_values.rs","lineNumber":23,"sourceCode":"use proc_macro2::{Ident, Span, TokenStream};\nuse syn::{\n    Error, Expr, Lit, LitStr, MetaNameValue, parse::Parser, punctuated::Punctuated,\n    spanned::Spanned,\n};\n\nuse crate::parse_utils::{ErrorsExt, validate_no_duplicates};\n\n#[derive(Debug)]\npub struct UniqueNameValues {\n    span: Span,\n    name_values: HashMap<Ident, Lit>,\n}\n\nimpl UniqueNameValues {\n    pub fn new(tokens: TokenStream) -> syn::Result<Self> {\n        let name_value_metas = Punctuated::<MetaNameValue, syn::token::Comma>::parse_terminated\n            .parse2(tokens)\n            .map_err(|e| Error::new(e.span(), \"expected name='value'\"))?;\n        let span = name_value_metas.span();\n        let name_values = Self::extract_name_values(name_value_metas.into_iter())?;\n\n        let names = name_values.iter().map(|(name, _)| name).collect::<Vec<_>>();\n        validate_no_duplicates(&names, |&&name| name.clone())?;\n\n        Ok(Self {\n            span,\n            name_values: name_values.into_iter().collect(),\n        })\n    }\n\n    pub fn try_get(&self, name: &str) -> Option<&Lit> {\n        self.name_values.get(&ident(name))\n    }\n\n    pub fn validate_has_no_other_names(&self, allowed_names: &[&str]) -> syn::Result<()> {\n        let expected_names = allowed_names","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/packages/fuels-macros/src/parse_utils/unique_name_values.rs#L5-L41","documentation":"Compile-time parsing error from fuels-macros' UniqueNameValues helper: attribute arguments must be a comma-separated list of name='value' pairs (syn::MetaNameValue). If the token stream cannot be parsed as such (positional argument, missing =, unquoted value, stray token), the underlying syn error is remapped to 'expected name='value'' with the offending span.","triggerScenarios":"Invoking a fuels attribute/macro whose inner argument list is parsed via UniqueNameValues::new (e.g. program-setup commands or program attributes) with malformed input: Project(\"counter\") instead of project=\"counter\", name=counter (bare ident, not a literal), a trailing comma artifact, or nested tokens that are not MetaNameValue pairs.","commonSituations":"Copying usage from an older SDK version with different attribute syntax; writing unquoted values out of habit from other ecosystems; the first underlying error being masked so the user sees only this generic message.","solutions":["Inspect the span rustc points at — it is the exact token where MetaNameValue parsing failed.","Rewrite the argument list as comma-separated name=\"string literal\" pairs, e.g. (name=\"counter\", project=\"../counter\").","Remove positional or expression arguments; every argument needs a key, an =, and a quoted literal.","Compare with a working example in the repo's tests/examples for the same macro."],"exampleFix":"// before\nsetup_program_test!(\n    Abigen(contract = \"counter\", abi = \"../out/debug/counter-abi.json\")\n)\n// after\nAbigen(\n    contracts = [(name = \"counter\", abi = \"../out/debug/counter-abi.json\")]\n)","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write attribute args as name=\"value\" string-literal pairs separated by commas.","Copy argument syntax from the repo's own tests/examples rather than from memory.","Fix the first macro error first — later spans often cascade from the first malformed token."],"tags":["rust","macro","compile-time","attributes","fuels-macros"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}