abhigyanpatwari/GitNexus · error · Error
Spring YAML traversal exceeds ${MAX_YAML_TRAVERSAL_NODES} no
Error message
Spring YAML traversal exceeds ${MAX_YAML_TRAVERSAL_NODES} nodes What it means
A node-count guard inside the Spring YAML traversal (`consumeYamlTraversalBudget`). It decrements `remainingNodes` (initialized to `MAX_YAML_TRAVERSAL_NODES` = 100,000) for every node visited and throws when the budget goes negative. Because shared anchors/aliases can cause a node to be revisited, the walk can amplify a moderately-sized file; this cap bounds total work and prevents a pathological or adversarial config from stalling ingestion.
Source
Thrown at gitnexus/src/core/ingestion/pipeline-phases/spring-config.ts:170
}
interface YamlMappingLocation {
readonly valueEvent: YamlParseEvent;
readonly line: number;
}
interface YamlTraversalState {
remainingNodes: number;
readonly activeObjects: Set<object>;
}
function consumeYamlTraversalBudget(state: YamlTraversalState, depth: number): void {
if (depth > MAX_YAML_TRAVERSAL_DEPTH) {
throw new Error(`Spring YAML traversal depth exceeds ${MAX_YAML_TRAVERSAL_DEPTH}`);
}
state.remainingNodes--;
if (state.remainingNodes < 0) {
throw new Error(`Spring YAML traversal exceeds ${MAX_YAML_TRAVERSAL_NODES} nodes`);
}
}
function isObjectValue(value: unknown): value is object {
return value !== null && typeof value === 'object';
}
// Aliases are resolved to their anchor event by name while the tree is built,
// so following one here is a single pointer hop.
function resolveYamlAliasEvent(event: YamlParseEvent | undefined): YamlParseEvent | undefined {
return event?.aliasOf ?? event;
}
function yamlMappingPairs(event: YamlParseEvent): Array<{
key: string;
keyEvent: YamlParseEvent;
valueEvent: YamlParseEvent;
}> {View on GitHub (pinned to d540b00184)
Solutions
- Split the oversized Spring YAML into smaller per-profile/per-service files.
- Reduce reliance on YAML anchors that force repeated subtree revisits during traversal.
- Exclude the file from indexing via `.gitnexusignore` if it is not essential to code intelligence.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await extractSpringConfig(repoPath);
} catch (err) {
if (/Spring YAML traversal exceeds .* nodes/.test(err.message)) {
// The file exceeded the 100k-node traversal cap — log and continue,
// or split the config.
logger.warn(`Oversized Spring config skipped: ${err.message}`);
return;
}
throw err;
} Prevention
- Split monolithic Spring configs into per-service/per-profile files.
- Minimize YAML anchor reuse that forces repeated subtree traversal.
- Exclude oversized non-essential config via .gitnexusignore.
When it happens
Trigger: The Spring YAML walk visits more than 100,000 nodes cumulative — the `remainingNodes` counter drops below zero in `consumeYamlTraversalBudget`. Happens with very large config files or with alias-heavy YAML where the traversal revisits shared subtrees many times.
Common situations: A monorepo with a massive shared Spring config referenced by many anchors; a generated YAML with thousands of repeated keys; adversarial input intended to slow ingestion.
Related errors
- Spring YAML traversal depth exceeds ${MAX_YAML_TRAVERSAL_DEP
- Invalid YAML: expected an object
- version is required in group.yaml
- Unsupported group.yaml version: ${raw.version}. Expected 1.
- name is required in group.yaml
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/89d2b2db7b2a5ef9.
Report an issue: GitHub.