block/buzz · error · syn::Error

duplicate `system` argument

Error message

duplicate `system` argument

What it means

Same Parse impl as the duplicate-name check, guarding the `system` key of #[datastore_span]: a second system = "..." argument is rejected at the duplicate key's span with 'duplicate `system` argument'. Compile-time only; the macro additionally requires system == "postgresql" once parsed (unsupported values are a separate error).

Source

Thrown at crates/buzz-datastore-tracing/src/lib.rs:35

impl Parse for DatastoreArgs {
    fn parse(input: ParseStream<'_>) -> Result<Self> {
        let mut name = None;
        let mut system = None;
        let mut fields = None;

        while !input.is_empty() {
            let key: Ident = input.parse()?;
            match key.to_string().as_str() {
                "name" => {
                    if name.is_some() {
                        return Err(Error::new(key.span(), "duplicate `name` argument"));
                    }
                    input.parse::<Token![=]>()?;
                    name = Some(input.parse()?);
                }
                "system" => {
                    if system.is_some() {
                        return Err(Error::new(key.span(), "duplicate `system` argument"));
                    }
                    input.parse::<Token![=]>()?;
                    system = Some(input.parse()?);
                }
                "fields" => {
                    if fields.is_some() {
                        return Err(Error::new(key.span(), "duplicate `fields` argument"));
                    }
                    let content;
                    parenthesized!(content in input);
                    fields = Some(content.parse()?);
                }
                _ => {
                    return Err(Error::new(
                        key.span(),
                        "expected `name`, `system`, or `fields`",
                    ))
                }

View on GitHub (pinned to eed74bde2f)

Solutions

  1. Remove the duplicated `system = ...` entry, keeping exactly one (and value "postgresql" — the only supported system).
  2. Re-run `cargo check` on the failing crate to verify.
  3. Prefer `just fix-all`/fmt only after the syntax is valid — the compile error blocks everything downstream.

Example fix

// before
#[datastore_span(name = "insert_event", system = "postgresql", system = "postgres")]

// after
#[datastore_span(name = "insert_event", system = "postgresql")]
Defensive patterns

Strategy: validation

Validate before calling

// compile-time only: `cargo check -p buzz-db` reports the duplicate `system` span

Prevention

When it happens

Trigger: #[datastore_span(name = "x", system = "postgresql", system = "postgresql")] — the second system key trips the check at crates/buzz-datastore-tracing/src/lib.rs:34-36. Typical after a bad merge or a copy-paste where someone 'clarified' the system twice.

Common situations: Merge conflicts on annotated datastore functions; refactoring that moved attributes around and re-added system; scripted codemods appending arguments instead of replacing them.

Related errors


AI-assisted analysis of block/buzz@eed74bde2f (2026-08-20). Data as JSON: /api/errors/b8e01a078ab2cd83. Report an issue: GitHub.