{"record":{"id":"cecc3fe50bbc2b8a","repo":"abhigyanpatwari/GitNexus","slug":"spring-yaml-traversal-depth-exceeds-max-yaml-tra","errorCode":null,"errorMessage":"Spring YAML traversal depth exceeds ${MAX_YAML_TRAVERSAL_DEPTH}","messagePattern":"Spring YAML traversal depth exceeds (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/ingestion/pipeline-phases/spring-config.ts","lineNumber":166,"sourceCode":"  readonly kind: 'scalar' | 'sequence' | 'mapping' | 'alias' | null;\n  readonly result: unknown;\n  readonly aliasOf: YamlParseEvent | undefined;\n  readonly children: YamlParseEvent[];\n}\n\ninterface YamlMappingLocation {\n  readonly valueEvent: YamlParseEvent;\n  readonly line: number;\n}\n\ninterface YamlTraversalState {\n  remainingNodes: number;\n  readonly activeObjects: Set<object>;\n}\n\nfunction consumeYamlTraversalBudget(state: YamlTraversalState, depth: number): void {\n  if (depth > MAX_YAML_TRAVERSAL_DEPTH) {\n    throw new Error(`Spring YAML traversal depth exceeds ${MAX_YAML_TRAVERSAL_DEPTH}`);\n  }\n  state.remainingNodes--;\n  if (state.remainingNodes < 0) {\n    throw new Error(`Spring YAML traversal exceeds ${MAX_YAML_TRAVERSAL_NODES} nodes`);\n  }\n}\n\nfunction isObjectValue(value: unknown): value is object {\n  return value !== null && typeof value === 'object';\n}\n\n// Aliases are resolved to their anchor event by name while the tree is built,\n// so following one here is a single pointer hop.\nfunction resolveYamlAliasEvent(event: YamlParseEvent | undefined): YamlParseEvent | undefined {\n  return event?.aliasOf ?? event;\n}\n\nfunction yamlMappingPairs(event: YamlParseEvent): Array<{","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/ingestion/pipeline-phases/spring-config.ts#L148-L184","documentation":"A depth guard inside the Spring YAML config traversal (`consumeYamlTraversalBudget`). The YAML event tree is walked to extract Spring config keys; this throws when the nesting `depth` exceeds `MAX_YAML_TRAVERSAL_DEPTH` (128). It is a hard cap against pathologically deep YAML (including runaway alias/anchor recursion), protecting the ingestion phase from a stack-blowing or time-bombing config file. The parser itself is also invoked with `maxDepth: 128`, so a file this deep is almost always malformed or malicious.","triggerScenarios":"The Spring config extractor encounters a `.yml`/`.yaml` file whose nesting depth exceeds 128 levels during `consumeYamlTraversalBudget`. Typically caused by recursive YAML anchors, machine-generated deeply-nested config, or a file misidentified as a Spring config that is actually data.","commonSituations":"A generated Spring config from a templating tool that emits deeply nested maps; a YAML file with self-referential anchors producing deep alias chains; a data file (not config) that landed in a `resources/` dir and was picked up by the Spring config heuristic.","solutions":["Inspect the reported Spring YAML file and flatten its structure to under 128 levels of nesting.","Remove or fix recursive/self-referential YAML anchors that inflate nesting depth.","If the file is not a real Spring config, move it out of the scanned config directory or add a `.gitnexusignore` rule for it."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await extractSpringConfig(repoPath);\n} catch (err) {\n  if (/Spring YAML traversal depth exceeds/.test(err.message)) {\n    // One config file is pathologically deep — log and continue indexing the rest,\n    // or surface to the operator to flatten the file.\n    logger.warn(`Skipping deeply-nested Spring config: ${err.message}`);\n    return;\n  }\n  throw err;\n}","preventionTips":["Lint Spring YAML files for excessive nesting in CI.","Avoid recursive YAML anchors in config consumed by GitNexus.","Keep machine-generated YAML flattened where possible."],"tags":["spring","yaml","config-parsing","ingestion","depth-limit"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}