Kong/insomnia · error

"extends" nested too deeply (max ${MAX_EXTENDS_DEPTH}) at ${

Error message

"extends" nested too deeply (max ${MAX_EXTENDS_DEPTH}) at ${absolute}

What it means

Error ""extends" nested too deeply (max ${MAX_EXTENDS_DEPTH}) at ${absolute}" thrown in Kong/insomnia.

Source

Thrown at packages/insomnia/src/main/bundle-spectral-ruleset.ts:29

const ALLOWED_EXTENSIONS = ['.yaml', '.yml'];

const REMOTE_FETCH_TIMEOUT_MS = 10_000;

// Represents a parsed Spectral ruleset object. Every top-level key other than
// "extends" is treated as opaque data and passed through unchanged.
type Ruleset = Record<string, unknown> & {
  extends?: string[];
};

// Safety checks for local-file extends entries:
// - Depth / cycle guard against infinite recursion.
// - Extension check ensures we only load YAML files.
// - rootDir guard prevents path traversal (e.g. '../../../etc/passwd') from
//   reaching files outside the directory of the originally-selected ruleset.
function assertAllowed(absolute: string, visited: Set<string>, depth: number, rootDir: string): void {
  if (depth > MAX_EXTENDS_DEPTH) {
    throw new Error(`"extends" nested too deeply (max ${MAX_EXTENDS_DEPTH}) at ${absolute}`);
  }
  if (visited.has(absolute)) {
    throw new Error(`"extends" cycle detected at ${absolute}`);
  }
  if (!ALLOWED_EXTENSIONS.includes(path.extname(absolute).toLowerCase())) {
    throw new Error(`"extends" target must be a .yaml or .yml file: ${absolute}`);
  }
  const rel = path.relative(rootDir, absolute);
  if (rel.startsWith('..') || path.isAbsolute(rel)) {
    throw new Error(`"extends" target must stay within the ruleset's root directory: ${absolute}`);
  }
}

// Reads a local ruleset file from disk and parses it.
async function readRuleset(absolute: string): Promise<Ruleset> {
  const raw = await fs.promises.readFile(absolute, { encoding: 'utf8' });
  const parsed = YAML.parse(raw);
  if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia/src/main/bundle-spectral-ruleset.ts:29 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kong/insomnia@d9bb2b0142 (2026-08-26). Data as JSON: /api/errors/c08afe844ffd4ee7. Report an issue: GitHub.