biomejs/biome · error · syn::Error

A list of attribute is expected

Error message

A list of attribute is expected

What it means

Compile-time error from biome_deserialize_macros' parse_meta_list helper (util.rs:8), used by the #[deserializable] and serde-compat attribute parsers. It requires the attribute to be in list form - Meta::List, i.e. name(...) with parentheses and nested items. If the attribute is a bare path (deprecated with no parentheses) or a name-value pair (name = "value"), the let-else fails and this 'A list of attribute is expected' error is emitted at the attribute's span.

Source

Thrown at crates/biome_deserialize_macros/src/util.rs:8

use syn::{Error, Meta, MetaList, NestedMeta, spanned::Spanned};

pub(crate) fn parse_meta_list(
    meta: &Meta,
    mut consume: impl FnMut(&Meta) -> Result<(), Error>,
) -> Result<(), Error> {
    let Meta::List(MetaList { nested, .. }) = meta else {
        return Err(Error::new(meta.span(), "A list of attribute is expected"));
    };
    for nested_meta in nested {
        let NestedMeta::Meta(meta) = nested_meta else {
            return Err(Error::new(nested_meta.span(), "Literals are not allowed"));
        };
        consume(meta)?;
    }
    Ok(())
}

View on GitHub (pinned to 405dedb0ff)

Solutions

  1. Write the attribute in list form with parentheses: #[deserializable(deprecated(message = "..."))]
  2. If you intended a bare flag, pick the supported inner item that expresses it (e.g. deprecated(use_instead = "...")) instead of the bare word
  3. Check nearby fields in the same crate for working examples of the attribute syntax

Example fix

// before
#[deserializable(deprecated)]
pub old_field: bool,

// after
#[deserializable(deprecated(use_instead = "NewField"))]
pub old_field: bool,
Defensive patterns

Strategy: validation

Validate before calling

// Rust - attributes must be written in list form: name(...)
#[deserializable(deprecated(message = "..."))] // parentheses required

Prevention

When it happens

Trigger: #[deserializable(deprecated)] (bare word, no parentheses), or a name-value form where a list is expected, e.g. writing an attribute as key = "value" when the parser expects key(...).

Common situations: Typing shorthand boolean-style attributes; converting a flag-style attribute into deserializable syntax; IDE auto-complete inserting just the path without the list.

Related errors


AI-assisted analysis of biomejs/biome@405dedb0ff (2026-08-20). Data as JSON: /api/errors/db3b9fe53981f09a. Report an issue: GitHub.