{"record":{"id":"9faa5304b95d3a96","repo":"denoland/deno","slug":"unknown-webidl-argument-expected-default-or-op","errorCode":null,"errorMessage":"unknown webidl argument, expected `default` or `options`","messagePattern":"unknown webidl argument, expected `default` or `options`","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"libs/ops/op2/signature.rs","lineNumber":321,"sourceCode":"            \"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![,]>()?;\n      }\n    }\n\n    Ok(WebIDLArgs { default, options })\n  }\n}\n\n/// Args are not a 1:1 mapping with Rust types, rather they represent broad classes of types that\n/// tend to have similar argument handling characteristics. This may need one more level of indirection\n/// given how many of these types have option variants, however.\n#[derive(Clone, Debug, Eq, PartialEq)]","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/libs/ops/op2/signature.rs#L303-L339","documentation":"`WebIDLArgs::parse` accepts exactly two keys inside `webidl(...)`: `default` and `options`. Any other identifier key raises this error on that key's span, listing the two valid alternatives.","triggerScenarios":"`#[op2(webidl(value = 3))]` or any `webidl(<key> ...)` where `<key>` is not `default` or `options`, e.g. typos like `defaults`, `optional`, or `values`.","commonSituations":"Guessing argument names based on general WebIDL knowledge (`optional`, `required`, `values`) instead of the two this macro supports; typos after refactoring.","solutions":["Use only `default = <expr>` (fallback value) and `options(...)` (allowed-value pairs) inside `webidl(...)`.","For optional parameters, type the parameter as `Option<T>` (the dictionary generator auto-defaults Options to None) instead of inventing an `optional` key.","Check the spelling — `defaults`/`Default` will not match."],"exampleFix":"// before\n#[op2(webidl(optional = true))]\ncolor: Color,\n\n// after\n#[op2(webidl(default = Color::Red))]\ncolor: Color,","handlingStrategy":"validation","validationCode":"// Compile-time: `cargo check`. Remember the closed set:\n//   webidl(default = <expr>)  and  webidl(options(...))\n// — there is no `optional`, `required`, or `values` key.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["For optional parameters use `Option<T>` in the signature instead of an invented key.","Double-check key spelling (`default`, `options`) before compiling."],"tags":["op2","webidl","proc-macro","unknown-argument","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"}