oxc-project/oxc · error · OxcDiagnostic
Call is nested too deeply. Maximum allowed is {max}.
Error message
Call is nested too deeply. Maximum allowed is {max}. What it means
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.
Source
Thrown at crates/oxc_linter/src/rules/unicorn/max_nested_calls.rs:16
use schemars::JsonSchema;
use serde::Deserialize;
use oxc_ast::AstKind;
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::{GetSpan, Span};
use crate::{
AstNode,
context::LintContext,
rule::{DefaultRuleConfig, Rule},
};
fn max_nested_calls_diagnostic(max: u32, span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("Call is nested too deeply. Maximum allowed is {max}."))
.with_help("Extract intermediate results into named variables to reduce nesting.")
.with_label(span)
}
#[derive(Debug, Clone, JsonSchema, Deserialize)]
#[serde(rename_all = "camelCase", default, deny_unknown_fields)]
pub struct MaxNestedCalls {
/// The maximum allowed nested call depth.
max: u32,
}
const DEFAULT_MAX_NESTED_CALLS: u32 = 3;
impl Default for MaxNestedCalls {
fn default() -> Self {
Self { max: DEFAULT_MAX_NESTED_CALLS }
}
}View on GitHub (pinned to e1e7af627c)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/unicorn/max_nested_calls.rs:16 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/2a2d9f0bd8af1173.
Report an issue: GitHub.