{"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":3252,"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 EVERY `Destination` node before an incremental writeback, so the async\n * messaging overlay is rebuilt whole from the fresh graph.\n *\n * Delete-all rather than delete-by-file, because the file-keyed rule cannot\n * express this layer in either direction. A RESOLVED destination stores no\n * `filePath` — that is what stops `deleteNodesForFiles` cutting a node shared\n * by files outside the write set — which also means it is never deleted when it\n * SHOULD be, so a destination whose last referrer stopped naming it survived as\n * an edgeless orphan that still carried `address`, the cross-repository join\n * key, accumulating on every run. The mirror defect was worse: without a","sourceCodeStart":3234,"sourceCodeEnd":3270,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/core/lbug/lbug-adapter.ts#L3234-L3270","documentation":"Spring AOP cleanup in lbug-adapter (gitnexus/src/core/lbug/lbug-adapter.ts:2945): before an incremental writeback re-materialises synthetic advice CodeElement nodes, the DETACH DELETE over them failed with something other than benign-missing-table. Continuing would leave stale advice metadata, so the run aborts and the crash-recovery dirty flag forces a full rebuild next run.","triggerScenarios":"Incremental writeback on a repo with Spring AOP evidence where the synthetic-node DELETE fails — lock contention with a concurrent reader, disk error, or native engine failure.","commonSituations":"Concurrent serve/MCP traffic on the same index during analyze; AV or disk pressure during the delete phase; an index recovering from an earlier crashed run.","solutions":["Re-run the analyze — the next run full-rebuilds from the dirty flag","Stop competing GitNexus processes on the repository before the incremental run","Check the embedded message for disk/lock causes and fix them","Persistent recurrence: gitnexus analyze --force"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"const isSpringAopClearFailure = (e: unknown): boolean =>\n  e instanceof Error &&\n  e.message.startsWith('[spring-aop] failed to clear synthetic evidence');","tryCatchPattern":"try {\n  await clearSpringAopEvidence();\n} catch (e) {\n  if (isSpringAopClearFailure(e)) {\n    // stale advice metadata risk — abort writeback, let the dirty flag force a full rebuild\n    logger.warn('spring-aop cleanup failed; next run will full-rebuild');\n  }\n  throw e;\n}","preventionTips":["Keep serve/MCP readers off the index during incremental writebacks","Address disk and lock issues flagged in the embedded native message before retrying","After any aborted incremental run, run the analyze again to complete the full rebuild"],"tags":["gitnexus","spring-aop","incremental","writeback","ladybugdb"],"backgroundTag":"incremental-sync-cleanup-failed","analyzedSha":"ac9a4e9abd8fd3058c070b72c23402a4f887929a","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}