pola-rs/polars · error

didn't recognize attribute

Error message

didn't recognize attribute

What it means

Attribute-parser failure in the #[polars_expr] derive support (attr.rs): while parsing the proc-macro attribute options (output_type, output_type_func, camelize, ...), the lookahead encountered a token that matches none of the recognised option keywords, so the attribute stream is malformed.

Source

Thrown at pyo3-polars/pyo3-polars-derive/src/attr.rs:54

impl Parse for ExprsFunctionOptions {
    fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
        let mut options = ExprsFunctionOptions::default();

        while !input.is_empty() {
            let lookahead = input.lookahead1();

            if lookahead.peek(keywords::output_type) {
                let attr = input.parse::<OutputAttribute>()?;
                options.output_dtype = Some(attr.value)
            } else if lookahead.peek(keywords::output_type_func) {
                let attr = input.parse::<OutputFuncAttribute>()?;
                options.output_type_fn = Some(attr.value)
            } else if lookahead.peek(keywords::output_type_func_with_kwargs) {
                let attr = input.parse::<OutputFuncAttributeWithKwargs>()?;
                options.output_type_fn_kwargs = Some(attr.value)
            } else {
                panic!("didn't recognize attribute")
            }
        }
        Ok(options)
    }
}

View on GitHub (pinned to 9b5d73fd00)

Solutions

  1. Use only attributes recognised by the derive macro; check the supported attribute names in pyo3-polars-derive and fix the attribute.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at pyo3-polars/pyo3-polars-derive/src/attr.rs:54 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19). Data as JSON: /api/errors/7f7e15531a8e3176. Report an issue: GitHub.