{"record":{"id":"0be5da0bdd35076a","repo":"FuelLabs/fuels-rs","slug":"missing-attribute-name","errorCode":null,"errorMessage":"missing attribute '{name}'","messagePattern":"missing attribute '(.+?)'","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fuels-macros/src/parse_utils/unique_name_values.rs","lineNumber":61,"sourceCode":"            .map(|name| format!(\"'{name}'\"))\n            .join(\", \");\n\n        self.name_values\n            .keys()\n            .filter(|name| !allowed_names.contains(&name.to_string().as_str()))\n            .map(|name| {\n                Error::new_spanned(\n                    name.clone(),\n                    format!(\"attribute '{name}' not recognized. Expected one of: {expected_names}\"),\n                )\n            })\n            .validate_no_errors()\n    }\n\n    pub fn get_as_lit_str(&self, name: &str) -> syn::Result<&LitStr> {\n        let value = self\n            .try_get(name)\n            .ok_or_else(|| Error::new(self.span, format!(\"missing attribute '{name}'\")))?;\n\n        if let Lit::Str(lit_str) = value {\n            Ok(lit_str)\n        } else {\n            Err(Error::new_spanned(\n                value.clone(),\n                format!(\"expected the attribute '{name}' to have a string value\"),\n            ))\n        }\n    }\n\n    fn extract_name_values<T: Iterator<Item = MetaNameValue>>(\n        name_value_metas: T,\n    ) -> syn::Result<Vec<(Ident, Lit)>> {\n        let (name_values, name_value_errors): (Vec<_>, Vec<Error>) = name_value_metas\n            .into_iter()\n            .map(|nv| {\n                let ident = nv.path.get_ident().cloned().ok_or_else(|| {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/packages/fuels-macros/src/parse_utils/unique_name_values.rs#L43-L79","documentation":"Compile-time error from fuels-macros' UniqueNameValues::get_as_lit_str: a required attribute key was not present in the parsed name='value' list. The macro asked for a mandatory string attribute (e.g. 'name' or 'project' on a program binding) and try_get returned None, so the error is emitted on the whole attribute's span.","triggerScenarios":"A program binding or command provides some attributes but omits a mandatory one parsed via get_as_lit_str — e.g. Contract(name=\"counter\") without project=..., or a command where the string-typed key is missing entirely (as opposed to present with a non-string value, which produces the separate 'expected the attribute ... to have a string value' error).","commonSituations":"Following a partial example that omits the key; SDK upgrades making a previously-optional attribute mandatory; assuming the key has a default.","solutions":["Read the message: it names the exact missing attribute '{name}'.","Add the missing key with a string literal value, e.g. Contract(name=\"counter\", project=\"../counter\").","Check the macro's validation of allowed names (validate_has_no_other_names) to see the full expected attribute set for that command.","Consult the docs/tests for the macro to confirm which keys are required vs optional."],"exampleFix":"// before\nsetup_program_test!(\n    Abigen(contracts = [(name = \"counter\")])\n)\n// after\nsetup_program_test!(\n    Abigen(contracts = [(name = \"counter\", project = \"../counter\")])\n)","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Consult the macro docs for required vs optional attributes before writing the invocation.","Copy a known-good invocation from the package's tests and edit values only.","The error names the missing key — fix it before investigating anything else."],"tags":["rust","macro","compile-time","attributes","required-field"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}