{"record":{"id":"08b4fbed9cb8ee89","repo":"block/buzz","slug":"duplicate-fields-argument","errorCode":null,"errorMessage":"duplicate `fields` argument","messagePattern":"duplicate `fields` argument","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/buzz-datastore-tracing/src/lib.rs","lineNumber":42,"sourceCode":"            let key: Ident = input.parse()?;\n            match key.to_string().as_str() {\n                \"name\" => {\n                    if name.is_some() {\n                        return Err(Error::new(key.span(), \"duplicate `name` argument\"));\n                    }\n                    input.parse::<Token![=]>()?;\n                    name = Some(input.parse()?);\n                }\n                \"system\" => {\n                    if system.is_some() {\n                        return Err(Error::new(key.span(), \"duplicate `system` argument\"));\n                    }\n                    input.parse::<Token![=]>()?;\n                    system = Some(input.parse()?);\n                }\n                \"fields\" => {\n                    if fields.is_some() {\n                        return Err(Error::new(key.span(), \"duplicate `fields` argument\"));\n                    }\n                    let content;\n                    parenthesized!(content in input);\n                    fields = Some(content.parse()?);\n                }\n                _ => {\n                    return Err(Error::new(\n                        key.span(),\n                        \"expected `name`, `system`, or `fields`\",\n                    ))\n                }\n            }\n            if !input.is_empty() {\n                input.parse::<Token![,]>()?;\n            }\n        }\n\n        Ok(Self {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/block/buzz/blob/eed74bde2f4797714335ac10c56c0b0244c1def4/crates/buzz-datastore-tracing/src/lib.rs#L24-L60","documentation":"The third duplicate-guard in #[datastore_span]'s Parse impl: `fields` is optional and parenthesized (fields(...)), and may appear only once; a second occurrence is rejected at the duplicate key's span with 'duplicate `fields` argument'. Note fields takes a parenthesized expression list, not `fields = ...` — using '=' after fields is a separate syntax error from syn.","triggerScenarios":"#[datastore_span(name = \"q\", system = \"postgresql\", fields(db.operation), fields(x))] at crates/buzz-datastore-tracing/src/lib.rs:40-42 — the second fields(...) group is rejected during macro expansion.","commonSituations":"Merging two annotated functions' extras fields lists instead of concatenating the contents; copy-paste adding a second fields(...) instead of editing the first; forgetting the argument is optional and 're-declaring' it.","solutions":["Merge both parenthesized field lists into a single fields(...) — comma-separate the tracing field expressions inside one group.","Drop fields entirely if none of the extra fields are needed (it is optional).","Verify with `cargo check -p <crate>`."],"exampleFix":"// before\n#[datastore_span(name = \"q\", system = \"postgresql\", fields(a = 1), fields(b = 2))]\n\n// after\n#[datastore_span(name = \"q\", system = \"postgresql\", fields(a = 1, b = 2))]","handlingStrategy":"validation","validationCode":"// compile-time only: `cargo check` points at the second `fields(...)` span","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember fields is optional and parenthesized — at most one fields(...) group per attribute.","When combining two annotated call sites, merge the field expressions into one group.","Grep for 'fields(' twice in one attribute during review: rg '#\\[datastore_span[^]]*fields\\([^)]*\\)[^]]*fields'"],"tags":["rust","proc-macro","compile-error","tracing","macro-arguments"],"backgroundTag":"duplicate-macro-argument","analyzedSha":"eed74bde2f4797714335ac10c56c0b0244c1def4","analyzedAt":"2026-08-20T04:38:24.874Z","contentChangedAt":"2026-08-20T04:38:24.874Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}