astral-sh/ruff · error · syn::Error
Unknown `cache_field` argument {name}
Error message
Unknown `cache_field` argument {name} What it means
A syn compile error from parsing #[cache_field(...)] attributes in the CacheKey derive: an argument name other than the supported `ignore` was found. The attribute grammar only accepts ignore, so anything else is rejected at compile time.
Source
Thrown at crates/ruff_macros/src/cache_key.rs:143
#[derive(Debug, Default)]
struct CacheKeyFieldAttributes {
ignore: bool,
}
impl Parse for CacheKeyFieldAttributes {
fn parse(input: ParseStream) -> syn::Result<Self> {
let mut attributes = CacheKeyFieldAttributes::default();
let args = input.parse_terminated(Ident::parse, Token![,])?;
for arg in args {
match arg.to_string().as_str() {
"ignore" => {
attributes.ignore = true;
}
name => {
return Err(Error::new(
arg.span(),
format!("Unknown `cache_field` argument {name}"),
));
}
}
}
Ok(attributes)
}
}
View on GitHub (pinned to 26f38c119c)
Solutions
- Use only #[cache_field(ignore)] on fields
- Remove the unsupported argument from the attribute
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/ruff_macros/src/cache_key.rs:143 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of astral-sh/ruff@26f38c119c (2026-09-05).
Data as JSON: /api/errors/e0b6f50e87852020.
Report an issue: GitHub.