{"record":{"id":"f2c7749fce734632","repo":"abhigyanpatwari/GitNexus","slug":"spring-aop-failed-to-clear-synthetic-evidence-be","errorCode":null,"errorMessage":"[spring-aop] failed to clear synthetic evidence before incremental re-write (${message}) — aborting to avoid stale advice metadata; the next run will full-rebuild","messagePattern":"\\[spring-aop\\] failed to clear synthetic evidence before incremental re-write \\((.+?)\\) — aborting to avoid stale advice metadata; the next run will full-rebuild","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/lbug/lbug-adapter.ts","lineNumber":2945,"sourceCode":"        `MATCH (n:CodeElement) WHERE ${predicate} RETURN count(n) AS cnt`,\n      );\n      const result = Array.isArray(countResult) ? countResult[0] : countResult;\n      const rows = await result.getAll();\n      const count = Number(rows[0]?.cnt ?? rows[0]?.[0] ?? 0);\n      if (count > 0) {\n        await closeQueryResults(\n          await c.query(`MATCH (n:CodeElement) WHERE ${predicate} DETACH DELETE n`),\n        );\n      }\n      if (countResult) await closeQueryResults(countResult);\n      return { nodesDeleted: count };\n    } catch (err) {\n      if (countResult) await closeQueryResults(countResult);\n      if (classifyDeleteAllError(err) === 'benign-missing-table') {\n        return { nodesDeleted: 0 };\n      }\n      const message = err instanceof Error ? err.message : String(err);\n      throw new Error(\n        '[spring-aop] failed to clear synthetic evidence before incremental re-write ' +\n          `(${message}) — aborting to avoid stale advice metadata; the next run will full-rebuild`,\n      );\n    }\n  });\n};\n\n/**\n * Drop Spring-owned auto-configuration `DECLARES` relationships before\n * incremental writeback. `DECLARES` is generic, so exact reason filtering is\n * required: other metadata systems must retain their own declarations.\n */\nexport const deleteSpringAutoConfigurationDeclarations = async (): Promise<{\n  edgesDeleted: number;\n}> =>\n  deleteAllRelationshipsOfType(\n    'DECLARES',\n    'spring-auto-configuration',","sourceCodeStart":2927,"sourceCodeEnd":2963,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/lbug/lbug-adapter.ts#L2927-L2963","documentation":"Thrown when clearing synthetic Spring AOP evidence (CodeElement nodes) before an incremental re-write fails with a non-benign error. Spring AOP synthetic nodes are injected by GitNexus's Spring analysis pass to represent advice/pointcut relationships; if they can't be cleanly deleted before re-injection, stale advice metadata would persist. The pattern mirrors deleteAllRelationshipsOfType: classifyDeleteAllError checks for 'benign-missing-table' (fresh DB), and anything else re-throws to force a full rebuild on the next run.","triggerScenarios":"During incremental writeback for a repository with Spring AOP annotations, the MATCH (n:CodeElement) WHERE ... DETACH DELETE query fails on a real LadybugDB error — connection lock contention, disk-full WAL write, native crash, or corrupted node state. The predicate filters for Spring-owned synthetic nodes; a failure here means those nodes couldn't be removed.","commonSituations":"Re-analyzing a Spring Boot project after modifying @Aspect/@Around/@Before annotated code; running incremental analysis while another process holds a lock on the graph; disk pressure during writeback; a corrupted DB state from a previous crashed incremental run where the dirty flag wasn't properly set.","solutions":["Re-run `gitnexus analyze` — the crash-recovery dirty flag triggers a full rebuild that recreates all nodes from scratch","Check the wrapped `message` for the specific LadybugDB error to determine if it's a lock (stop concurrent processes), disk (free space), or corruption issue","If the issue recurs, use `gitnexus analyze --force` to force a clean rebuild from scratch","Ensure no other GitNexus process (serve, MCP) is accessing the repository during analyze"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await clearSpringAopEvidence();\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('[spring-aop]')) {\n    logger.warn('Spring AOP evidence clear failed; next run will full-rebuild');\n  }\n  throw e;\n}","preventionTips":["Avoid concurrent process access to the repo during incremental writeback","Free disk space before re-analyzing Spring projects (AOP nodes add WAL pressure)","If the error recurs on every run, use `gitnexus analyze --force` to reset incremental state"],"tags":["ladybugdb","spring-aop","incremental-writeback","synthetic-nodes","delete-all"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}