{"record":{"id":"6ac0087f9c84a6e9","repo":"oxc-project/oxc","slug":"promise-prop-name-requires-1-argument-but-r","errorCode":null,"errorMessage":"`Promise.{prop_name}()` requires 1 argument, but received {args_len}.","messagePattern":"`Promise\\.(.+?)\\(\\)` requires 1 argument, but received (.+?)\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/promise/valid_params.rs","lineNumber":31,"sourceCode":"    OxcDiagnostic::warn(format!(\n        \"`Promise.{prop_name}()` requires 0 or 1 arguments, but received {args_len}.\"\n    ))\n    .with_label(span)\n}\n\nfn one_or_two_argument_required_diagnostic(\n    span: Span,\n    prop_name: &str,\n    args_len: usize,\n) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"`Promise.{prop_name}()` requires 1 or 2 arguments, but received {args_len}.\"\n    ))\n    .with_label(span)\n}\n\nfn one_argument_required_diagnostic(span: Span, prop_name: &str, args_len: usize) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"`Promise.{prop_name}()` requires 1 argument, but received {args_len}.\"\n    ))\n    .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct ValidParams;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Enforces the proper number of arguments are passed to Promise functions.\n    ///\n    /// This rule is generally unnecessary if using TypeScript.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Calling a Promise function with the incorrect number of arguments can lead to unexpected","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/promise/valid_params.rs#L13-L49","documentation":"Diagnostic from the oxlint rule `promise/valid-params` (plugin `promise`, category `correctness`). It fires when a combinator static (`Promise.race`, `Promise.all`, `Promise.allSettled`, `Promise.any`) or an instance method (`.catch`, `.finally`) is called with an argument count other than exactly 1. The combinators take one iterable of promises; `catch`/`finally` take exactly one callback. Extra arguments are ignored and a missing argument makes the combinator reject or behave unexpectedly (`Promise.all()` with no iterable throws a TypeError at runtime).","triggerScenarios":"`Promise.all(1, 2, 3)` (multiple args instead of one array); `Promise.race(1, 2)`; `somePromise().catch()`; `somePromise().finally(() => {}, () => {})`.","commonSituations":"Passing promises as varargs instead of an array; refactoring a `then(onSuccess, onFailure)` into `catch` but leaving two callbacks; helper functions forwarding `arguments` into `Promise.all`.","solutions":["Wrap the promises in a single array/iterable: `Promise.all([a, b, c])`","Give `catch`/`finally` exactly one callback each; chain multiple `.catch()` calls if needed","Add `tsc --noEmit` to CI to catch arity errors at compile time"],"exampleFix":"// before\nPromise.all(fetchA(), fetchB(), fetchC())\n\n// after\nPromise.all([fetchA(), fetchB(), fetchC()])","handlingStrategy":"type-guard","validationCode":"npx oxlint --promise/valid-params src/\ntsc --noEmit  # combinators and catch/finally arity checked via lib signatures","typeGuard":"// lib signatures guard arity at compile time:\n//   Promise.all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>   // exactly 1 iterable\n//   p.catch(onrejected): Promise<T>                                     // exactly 1 callback\n//   p.finally(onfinally): Promise<T>                                    // exactly 1 callback","tryCatchPattern":null,"preventionTips":["Always pass combinators a single array/iterable of promises","Chain extra `.catch()` calls instead of passing multiple callbacks","Run `tsc --noEmit` plus `npx oxlint --promise/valid-params` in CI"],"tags":["promise","async","lint","arguments","oxlint"],"backgroundTag":"wrong-function-arity","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}