tauri-apps/tauri · error · syn::Error

unexpected list input

Error message

unexpected list input

What it means

generate_context parses its attribute content as a sequence of syn Meta items: a bare path (config path/root) and name=value pairs. A Meta::List — an identifier directly followed by a parenthesized group — has no valid position here, so parsing aborts with 'unexpected list input' spanned over the attribute.

Source

Thrown at crates/tauri-macros/src/context.rs:118

                lit: Lit::Bool(LitBool { value, .. }),
                ..
              }) = v.value
              {
                test = value;
              } else {
                return Err(syn::Error::new(input.span(), "unexpected value for test"));
              }
            }
            name => {
              return Err(syn::Error::new(
                input.span(),
                format!("unknown attribute {name}"),
              ));
            }
          }
        }
        Meta::List(_) => {
          return Err(syn::Error::new(input.span(), "unexpected list input"));
        }
      }

      let _ = input.parse::<Token![,]>();
    }

    Ok(Self {
      config_file: config_file
        .unwrap_or_else(|| {
          std::env::var("CARGO_MANIFEST_DIR")
            .map(|m| PathBuf::from(m).join("tauri.conf.json"))
            .map_err(|e| e.to_string())
        })
        .map_err(|e| input.error(e))?,
      root: root.unwrap_or_else(|| {
        let mut segments = Punctuated::new();
        segments.push(PathSegment {
          ident: Ident::new("tauri", Span::call_site()),

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Use key = value form: #[tauri::generate_context(capabilities = ["core:default"])]
  2. Pass the optional config path as the leading bare string literal
  3. Check for stray parentheses where an equals sign was intended

Example fix

// before
#[tauri::generate_context(capabilities("core:default"))]
// after
#[tauri::generate_context(capabilities = ["core:default"])]
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: #[tauri::generate_context(capabilities(...))], #[tauri::generate_context(default(...))], or any name(...) group in the attribute; also typos where `=` degenerates into parentheses.

Common situations: List-style attribute syntax carried over from derive macros or other frameworks; refactoring name=value into helper-looking calls; hand-merging attributes incorrectly.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/8f9834975cbf5d72. Report an issue: GitHub.