{"record":{"id":"7b948f2820ec52fc","repo":"denoland/deno","slug":"duplicate-options-argument","errorCode":null,"errorMessage":"duplicate `options` argument","messagePattern":"duplicate `options` argument","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"libs/ops/op2/signature.rs","lineNumber":310,"sourceCode":"  fn parse(input: ParseStream) -> syn::Result<Self> {\n    let mut default: Option<WebIDLDefault> = None;\n    let mut options: Vec<WebIDLPair> = Vec::new();\n\n    while !input.is_empty() {\n      let key: Ident = input.parse()?;\n\n      if key == \"default\" {\n        if default.is_some() {\n          return Err(syn::Error::new(\n            key.span(),\n            \"duplicate `default` argument\",\n          ));\n        }\n        input.parse::<Token![=]>()?;\n        default = Some(WebIDLDefault(input.parse::<syn::Expr>()?));\n      } else if key == \"options\" {\n        if !options.is_empty() {\n          return Err(syn::Error::new(\n            key.span(),\n            \"duplicate `options` argument\",\n          ));\n        }\n        let content;\n        syn::parenthesized!(content in input);\n        let parsed_options =\n          content.parse_terminated(WebIDLPair::parse, Token![,])?;\n        options = parsed_options.into_iter().collect();\n      } else {\n        return Err(syn::Error::new(\n          key.span(),\n          \"unknown webidl argument, expected `default` or `options`\",\n        ));\n      }\n\n      if !input.is_empty() {\n        input.parse::<Token![,]>()?;","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/libs/ops/op2/signature.rs#L292-L328","documentation":"Same parser as above: `WebIDLArgs::parse` permits at most one `options(...)` group per webidl attribute. It raises this error on the span of the second `options` key; options themselves are a comma-terminated list of WebIDLPairs inside a single group.","triggerScenarios":"`#[op2(webidl(options(a = \"x\"), options(b = \"y\")))]` — two `options(...)` groups in one attribute; or repeating `options(...)` after other arguments like `default`.","commonSituations":"Extending an options list by pasting a second `options(...)` group instead of adding pairs to the existing one.","solutions":["Merge all pairs into one `options(...)` group: `options(a = \"x\", b = \"y\")`.","Delete the stale group left behind by a copy-paste."],"exampleFix":"// before\n#[op2(webidl(options(prefix = \"-\"), options(suffix = \"+\")))]\nmode: String,\n\n// after\n#[op2(webidl(options(prefix = \"-\", suffix = \"+\")))]\nmode: String,","handlingStrategy":"validation","validationCode":"// Compile-time: `cargo check`. When hand-writing, keep all option pairs inside\n// a single `options(...)` group: options(a = \"x\", b = \"y\").","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never paste a second `options(...)` group; extend the existing one with a comma.","Treat `webidl(...)` as a set of unique keys: `default` once, `options` once."],"tags":["op2","webidl","proc-macro","duplicate-argument","compile-time"],"backgroundTag":"duplicate-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"}