{"record":{"id":"fe0f2f894ba0e384","repo":"abhigyanpatwari/GitNexus","slug":"deletenodesforfiles-embedding-table-name-table","errorCode":null,"errorMessage":"deleteNodesForFiles: ${EMBEDDING_TABLE_NAME} table does not exist — skipping embedding-row deletes for this writeback.","messagePattern":"deleteNodesForFiles: (.+?) table does not exist — skipping embedding-row deletes for this writeback\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"gitnexus/src/core/lbug/lbug-adapter.ts","lineNumber":2589,"sourceCode":"    // `e.nodeId = n.id` equality is exact — no `File:a.ts` / `File:a.tsx`\n    // prefix collisions. ORDER IS LOAD-BEARING: this must run BEFORE the\n    // DETACH DELETE loop below — once the nodes are gone the join matches\n    // nothing (empirically verified against @ladybugdb/core 0.18.0).\n    try {\n      await queryAndDrain(\n        targetConn,\n        `MATCH (n:${embeddableLabelMatch()}) WHERE n.filePath IN ${listLiteral} ` +\n          `MATCH (e:${EMBEDDING_TABLE_NAME}) WHERE e.nodeId = n.id DELETE e`,\n      );\n    } catch (err) {\n      // Tolerate exactly the missing-embedding-table binder error: a\n      // build-variant DB without EMBEDDING_SCHEMA would otherwise brick\n      // every incremental run until `--force` (FIX 4). The no-swallow\n      // policy stays for every real failure — anything else rethrows.\n      if (!isMissingEmbeddingTableError(err)) throw err;\n      if (!warnedMissingEmbeddingTable) {\n        warnedMissingEmbeddingTable = true;\n        logger.warn(\n          { err },\n          `deleteNodesForFiles: ${EMBEDDING_TABLE_NAME} table does not exist — ` +\n            'skipping embedding-row deletes for this writeback.',\n        );\n      }\n    }\n    for (const tableName of NODE_TABLES) {\n      // Community/Process are graph-wide (no filePath); the orchestrator\n      // drops them wholesale via deleteAllCommunitiesAndProcesses.\n      if (tableName === 'Community' || tableName === 'Process') continue;\n      const tn = escapeTableName(tableName);\n      await queryAndDrain(\n        targetConn,\n        `MATCH (n:${tn}) WHERE n.filePath IN ${listLiteral} DETACH DELETE n`,\n      );\n    }\n    options.onChunk?.(\n      Math.min((chunkIndex + 1) * DELETE_FILES_CHUNK_SIZE, filePaths.length),","sourceCodeStart":2571,"sourceCodeEnd":2607,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/aac7515d2a8c50a1f8f923c6fb77218b333560d6/gitnexus/src/core/lbug/lbug-adapter.ts#L2571-L2607","documentation":"deleteNodesForFiles (plural, the #2409 incremental writeback path with the STRICT policy) tolerates exactly one failure: the EMBEDDING table binder error from a build-variant DB without EMBEDDING_SCHEMA, which would otherwise brick every incremental run until --force. Every other error rethrows. The warn fires once per writeback thanks to the warnedMissingEmbeddingTable flag.","triggerScenarios":"Incremental writeback deletes nodes for changed files; the embedding-row DELETE prepare fails with the missing-embedding-table binder error; isMissingEmbeddingTableError(err) is true so it warns (once) and continues to the per-table deletes instead of throwing.","commonSituations":"Repos indexed before embeddings shipped or with embedding generation disabled; a build-variant DB that never ran EMBEDDING_SCHEMA; upgrading tooling that now does incremental writebacks against that old DB.","solutions":["Run one full `--force` rebuild with a current version to create the EMBEDDING table; the warn disappears on later incremental runs.","If you deliberately run without embeddings, treat the once-per-writeback warn as informational.","Any OTHER error from this function rethrows — fix those before assuming schema drift.","Keep one CLI version owning a given .gitnexus DB to avoid schema-variant mixing."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Once per writeback: probe the table, then skip embedding deletes knowingly\nconst hasTable = await tableExists(targetConn, EMBEDDING_TABLE_NAME);\nif (!hasTable) {\n  await deleteNodesForFiles(targets.filter(t => !t.needsEmbeddings)); // or plan a --force rebuild\n}","typeGuard":"import { isMissingEmbeddingTableError } from './binder-errors.js';\n// the strict variant rethrows EVERYTHING except this one error — narrow precisely:\nfunction tolerable(err: unknown): boolean { return isMissingEmbeddingTableError(err); }","tryCatchPattern":"try {\n  await deleteNodesForFiles(changedFiles);\n} catch (err) {\n  if (!isMissingEmbeddingTableError(err)) throw err; // real failure — surfaces\n  // expected warn already logged once this writeback; continue\n}","preventionTips":["Rebuild with --force once to create EMBEDDING_SCHEMA if embeddings are wanted.","Rely on the once-per-writeback warn (warnedMissingEmbeddingTable) rather than muting the logger.","Never broaden this catch — the STRICT policy exists so real writeback failures are not swallowed."],"tags":["ladybugdb","embeddings","incremental","writeback","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"}