{"record":{"id":"2a2d9f0bd8af1173","repo":"oxc-project/oxc","slug":"call-is-nested-too-deeply-maximum-allowed-is-max","errorCode":null,"errorMessage":"Call is nested too deeply. Maximum allowed is {max}.","messagePattern":"Call is nested too deeply\\. Maximum allowed is (.+?)\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/max_nested_calls.rs","lineNumber":16,"sourceCode":"use schemars::JsonSchema;\nuse serde::Deserialize;\n\nuse oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn max_nested_calls_diagnostic(max: u32, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Call is nested too deeply. Maximum allowed is {max}.\"))\n        .with_help(\"Extract intermediate results into named variables to reduce nesting.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Clone, JsonSchema, Deserialize)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct MaxNestedCalls {\n    /// The maximum allowed nested call depth.\n    max: u32,\n}\n\nconst DEFAULT_MAX_NESTED_CALLS: u32 = 3;\n\nimpl Default for MaxNestedCalls {\n    fn default() -> Self {\n        Self { max: DEFAULT_MAX_NESTED_CALLS }\n    }\n}","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/max_nested_calls.rs#L1-L34","documentation":"Raised by unicorn/max-nested-calls when a call expression is nested deeper inside other calls than the configured maximum (default 80-ish per option). The rule counts call nesting depth during run(); the offending input is the overly nested call chain at the labeled span.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/max_nested_calls.rs:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Extract intermediate results into named variables to flatten the call chain","Split complex expressions into multiple statements","Raise the `max` option if deep nesting is acceptable in your codebase"],"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-14T05:17:10.506Z"}