{"record":{"id":"058f0ab90951d917","repo":"oxc-project/oxc","slug":"unexpected-await-on-a-non-promise-value","errorCode":null,"errorMessage":"Unexpected `await` on a non-Promise value","messagePattern":"Unexpected `await` on a non-Promise value","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/no_unnecessary_await.rs","lineNumber":14,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{AwaitExpression, Expression},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_semantic::AstNodes;\nuse oxc_span::Span;\nuse oxc_syntax::operator::{UnaryOperator, UpdateOperator};\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn no_unnecessary_await_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected `await` on a non-Promise value\")\n        .with_help(\"Consider removing the `await`\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoUnnecessaryAwait;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Disallow awaiting on non-promise values.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// The `await` operator should only be used on `Promise` values.\n    ///\n    /// ### Examples\n    ///","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/no_unnecessary_await.rs#L1-L32","documentation":"Raised by unicorn/no-unnecessary-await when `await` is applied to an expression the rule determines is not thenable (a plain value, non-promise variable, etc.). The faulting input is the redundant await expression at the labeled span; removing it is the intended fix.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/no_unnecessary_await.rs:14 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the `await` keyword from the non-promise expression","If the value can be a promise, keep `await` and disable the rule for that line"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}