{"record":{"id":"919fc7a35876a66f","repo":"denoland/deno","slug":"unknown-attribute-attr-name","errorCode":null,"errorMessage":"Unknown attribute `{attr_name}`","messagePattern":"Unknown attribute `(.+?)`","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"libs/ops/op2/signature.rs","lineNumber":1437,"sourceCode":"      let source = match buf {\n        \"buffer\" => BufferSource::TypedArray,\n        \"anybuffer\" => BufferSource::Any,\n        \"arraybuffer\" => BufferSource::ArrayBuffer,\n        _ => unreachable!(),\n      };\n\n      Some(AttributeModifier::Buffer(mode, source))\n    }\n\n    // async is a keyword and does not work as #[async] so we use #[async_method] instead\n    \"required\" | \"rename\" | \"method\" | \"getter\" | \"setter\" | \"fast\"\n    | \"async_method\" | \"static_method\" | \"constructor\" | \"meta\" => {\n      Some(AttributeModifier::Ignore)\n    }\n\n    \"allow\" | \"doc\" | \"cfg\" => None,\n    attr_name => {\n      return Err(AttributeError::InvalidAttribute(syn::Error::new(\n        attr.meta.span(),\n        format!(\"Unknown attribute `{attr_name}`\"),\n      )));\n    }\n  };\n\n  Ok(modifier)\n}\n\nfn parse_numeric_type(tp: &Path) -> Result<NumericArg, ArgError> {\n  if tp.segments.len() == 1 {\n    let segment = tp.segments.first().unwrap().ident.to_string();\n    for numeric in NumericArg::iter() {\n      if Into::<&'static str>::into(numeric) == segment.as_str() {\n        return Ok(numeric);\n      }\n    }\n  }","sourceCodeStart":1419,"sourceCodeEnd":1455,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/libs/ops/op2/signature.rs#L1419-L1455","documentation":"This is the catch-all of op2's attribute classifier (libs/ops/op2/signature.rs): every attribute on op parameters/fields must map to a known modifier (`string`, `buffer`, `number`, `serde`, `smi`, `webidl`, ...), be in the ignore list (`required`, `rename`, `method`, `getter`, `setter`, `fast`, `async_method`, `static_method`, `constructor`, `meta`), or be one of `allow`/`doc`/`cfg` (returned as `None` so external tooling consumes them). Anything else is rejected with `Unknown attribute \\`{attr_name}\\``.","triggerScenarios":"Attaching an unrecognized attribute to an op parameter or op item: `#[op2(serializable)]`, `#[op2(cached)]`, `#[param]`, or a helper-attribute typo like `#[stirng]`; also attributes meant for other derives (e.g. a serde attribute on an op2 signature).","commonSituations":"Mixing serde/validator/clap-style attributes into an op signature; upgrading deno_core where a helper attribute was renamed; typos in the well-known modifiers.","solutions":["Remove the attribute or replace it with the op2 equivalent (e.g. use `#[serde]` for serde conversion, `#[smi]`/`#[number]` for numerics, `#[string]`/`#[buffer]` for the respective types).","If the attribute targets another derive, move it onto the type definition, not the op signature.","Check the exact spelling against the match arms: only `allow`, `doc`, and `cfg` foreign attributes pass through untouched."],"exampleFix":"// before\n#[op2]\nfn op_fetch(#[cached] #[string] url: String) -> String { /* ... */ }\n\n// after\n#[op2]\nfn op_fetch(#[string] url: String) -> String { /* ... */ }","handlingStrategy":"validation","validationCode":"// Compile-time: `cargo check`. Before adding an attribute to an op signature,\n// verify it appears in op2's match list (libs/ops/op2/signature.rs) or is one of\n// `allow` / `doc` / `cfg`.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep attributes from other derives (serde, validator, ...) on the type definition, not on op parameters.","After upgrading deno_core, re-check helper-attribute names — renamed modifiers surface as this error."],"tags":["op2","proc-macro","unknown-attribute","compile-time"],"backgroundTag":"unknown-macro-argument","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}