{"record":{"id":"1f04bf09777d1557","repo":"abhigyanpatwari/GitNexus","slug":"deletenodesforfile-embedding-table-name-table","errorCode":null,"errorMessage":"deleteNodesForFile: ${EMBEDDING_TABLE_NAME} table does not exist — skipping embedding-row deletes for this DB.","messagePattern":"deleteNodesForFile: (.+?) table does not exist — skipping embedding-row deletes for this DB\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"gitnexus/src/core/lbug/lbug-adapter.ts","lineNumber":2467,"sourceCode":"    // DELETE loop below the join would match nothing.\n    try {\n      await queryAndDrain(\n        targetConn!,\n        `MATCH (n:${embeddableLabelMatch()}) WHERE n.filePath = '${escapedPath}' ` +\n          `MATCH (e:${EMBEDDING_TABLE_NAME}) WHERE e.nodeId = n.id DELETE e`,\n      );\n    } catch (err) {\n      // Deliberately legacy-permissive (pinned contract:\n      // lbug-conn-serialization U5 and lbug-core-adapter expect this variant\n      // to resolve `{deletedNodes: 0}` even on a bogus dbPath): the singular\n      // variant swallows per-statement failures wholesale — its per-table\n      // loop below does the same — so a partial rethrow here would be\n      // incoherent with the rest of the function. The STRICT\n      // rethrow-except-missing-table policy lives in deleteNodesForFiles,\n      // the #2409 incremental writeback path (FIX 4). The one case worth a\n      // diagnostic is the missing embedding table.\n      if (isMissingEmbeddingTableError(err)) {\n        logger.warn(\n          { err },\n          `deleteNodesForFile: ${EMBEDDING_TABLE_NAME} table does not exist — ` +\n            'skipping embedding-row deletes for this DB.',\n        );\n      }\n    }\n\n    // Delete nodes from each table that has filePath\n    // DETACH DELETE removes the node and all its relationships\n    for (const tableName of NODE_TABLES) {\n      // Skip tables that don't have filePath (Community, Process)\n      if (tableName === 'Community' || tableName === 'Process') continue;\n\n      try {\n        // First count how many we'll delete. On the singleton connection this\n        // count runs inside withConnLock (incremental --pdg writeback executes\n        // while the WAL driver is live); per-query/temp connections skip the\n        // lock, matching queryAndDrain's `targetConn === conn` gate — the sibling","sourceCodeStart":2449,"sourceCodeEnd":2485,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/aac7515d2a8c50a1f8f923c6fb77218b333560d6/gitnexus/src/core/lbug/lbug-adapter.ts#L2449-L2485","documentation":"deleteNodesForFile (the singular legacy variant) hit the pinned legacy-permissive contract: it resolves {deletedNodes: 0} even on a bogus dbPath and swallows per-statement failures wholesale. The one diagnostic it emits is when the EMBEDDING table does not exist — embedding-row deletes are skipped for this DB. Node-table deletes in the loop below proceed (or fail silently) per the same permissive policy.","triggerScenarios":"Calling deleteNodesForFile on a DB created by a build variant without EMBEDDING_SCHEMA — the `MATCH (e:EMBEDDING_TABLE) WHERE e.nodeId = n.id DELETE e` prepare fails with the binder's missing-table error, isMissingEmbeddingTableError matches, and the warn fires before the per-node-table loop.","commonSituations":"Databases indexed by older gitnexus versions or embedding-free configurations; mixing CLI versions against one .gitnexus directory; test fixtures built with a reduced schema.","solutions":["If you need embeddings, do a full rebuild (`gitnexus analyze --force`) with a current version so EMBEDDING_SCHEMA is created.","If embeddings are intentionally unused, ignore the warn — deletes of file nodes continue in the loop below.","Prefer deleteNodesForFiles (plural) for the strict rethrow-except-missing-table behavior on the incremental writeback path.","Check which schema variant created the DB (index age/version) before incremental updates."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Before incremental deletes: does this DB have the embedding table?\nconst rows = await readQueryRows(await conn.query(\"CALL SHOW_TABLES() WHERE name = 'EMBEDDING_TABLE'\"));\nconst hasEmbeddings = rows.length > 0; // if false, the warn is expected, not a defect","typeGuard":"import { isMissingEmbeddingTableError } from './binder-errors.js';\n// narrows catch(unknown) to the one tolerated variant\nfunction isExpectedSchemaDrift(err: unknown): boolean {\n  return isMissingEmbeddingTableError(err);\n}","tryCatchPattern":"try {\n  await deleteNodesForFile(dbPath, filePath);\n} catch (err) {\n  // singular variant is legacy-permissive and rarely throws; embedding-missing only warns\n  throw err;\n}","preventionTips":["Use deleteNodesForFiles (plural) for new code — its STRICT policy only tolerates this exact case.","Full-rebuild (analyze --force) after upgrading across the embeddings boundary.","One CLI version per .gitnexus DB to avoid schema-variant mixing."],"tags":["ladybugdb","embeddings","schema-drift","incremental","missing-table"],"backgroundTag":"missing-table-schema-drift","analyzedSha":"aac7515d2a8c50a1f8f923c6fb77218b333560d6","analyzedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-08-31T04:17:50.494Z"}