biomejs/biome · error · syn::Error

Unexpected attribute inside deprecated(): {path_text}

Error message

Unexpected attribute inside deprecated(): {path_text}

What it means

Compile-time error from the #[deserializable] derive (struct_field_attrs.rs:113). Inside deprecated(...), a correctly shaped name-value item with a string literal must still use a known key: only path message and path use_instead are recognized. Any other key falls to the final else branch, which renders the path (e.g. 'since') into 'Unexpected attribute inside deprecated(): ...' at that path's span.

Source

Thrown at crates/biome_deserialize_macros/src/deserializable_derive/struct_field_attrs.rs:113

                                else {
                                    let meta_text = meta.to_token_stream().to_string();
                                    return Err(Error::new(
                                        meta.span(),
                                        format_args!("Unexpected attribute: {meta_text}"),
                                    ));
                                };
                                deprecated = if deprecated.is_some() {
                                    return Err(Error::new(
                                        meta.span(),
                                        "Only one attribute expected inside deprecated()",
                                    ));
                                } else if path.is_ident("message") {
                                    Some(DeprecatedField::Message(s.value()))
                                } else if path.is_ident("use_instead") {
                                    Some(DeprecatedField::UseInstead(s.value()))
                                } else {
                                    let path_text = path.to_token_stream().to_string();
                                    return Err(Error::new(
                                        path.span(),
                                        format_args!(
                                            "Unexpected attribute inside deprecated(): {path_text}"
                                        ),
                                    ));
                                };
                                Ok(())
                            })?;
                            opts.deprecated = deprecated;
                        }
                        _ => {
                            let meta_text = meta.to_token_stream().to_string();
                            return Err(Error::new(
                                meta.span(),
                                format_args!("Unexpected attribute: {meta_text}"),
                            ));
                        }
                    }

View on GitHub (pinned to 405dedb0ff)

Solutions

  1. Replace the unknown key with one of the two supported ones: deprecated(message = "...") or deprecated(use_instead = "...")
  2. Remove attributes carrying unsupported metadata - put version history in a doc comment (/// ...) instead of the attribute

Example fix

// before
#[deserializable(deprecated(note = "renamed"))]
pub rename: bool,

// after
#[deserializable(deprecated(message = "Use `renamed` instead."))]
pub rename: bool,
Defensive patterns

Strategy: validation

Validate before calling

// Rust - the only supported keys are message and use_instead
#[deserializable(deprecated(message = "..."))]
#[deserializable(deprecated(use_instead = "..."))]

Prevention

When it happens

Trigger: #[deserializable(deprecated(since = "1.2"))], deprecated(note = "..."), deprecated(reason = "..."), or any other well-formed string name-value pair with an unsupported key.

Common situations: Porting serde attributes (since/note are common in serde ecosystems) or doc-comment conventions into deserializable; guessing a key name instead of checking the macro's supported vocabulary.

Related errors


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