{"record":{"id":"4d05ed7689a92f70","repo":"santifer/career-ops","slug":"report-saved-but-could-not-merge-tracker-add","errorCode":null,"errorMessage":"⚠️   Report saved, but could not merge tracker addition into data/applications.md: ${err.message}","messagePattern":"⚠️   Report saved, but could not merge tracker addition into data/applications\\.md: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gemini-eval.mjs","lineNumber":600,"sourceCode":"      console.log(`📊  Tracker addition saved: batch/tracker-additions/${num}-${companySlug}.tsv`);\n      reportSaved = true;\n    } catch (err) {\n      console.warn(`⚠️   Could not save report: ${err.message}`);\n      process.exitCode = 1;\n    }\n\n    if (reportSaved) {\n      try {\n        const mergeOutput = execFileSync(process.execPath, [join(CODE_ROOT, 'merge-tracker.mjs')], {\n          cwd: CODE_ROOT,\n          encoding: 'utf-8',\n          stdio: ['ignore', 'pipe', 'pipe'],\n          timeout: 30000,\n        });\n        if (mergeOutput.trim()) console.log(mergeOutput.trim());\n        console.log('📊  Tracker merged into data/applications.md.');\n      } catch (err) {\n        console.warn(`⚠️   Report saved, but could not merge tracker addition into data/applications.md: ${err.message}`);\n        process.exitCode = 1;\n      }\n    }\n  } finally {\n    if (reservedNumbers.length > 0) {\n      try {\n        await releaseReportNumbers(reservedNumbers, { rootDir: DATA_ROOT, reportsDir: PATHS.reports });\n      } catch (err) {\n        console.warn(`⚠️   Could not release report reservation: ${err.message}`);\n      }\n    }\n  }\n}\n\nconsole.log('\\n' + '─'.repeat(66));\nconsole.log(`  Score: ${score}/5  |  Archetype: ${archetype}  |  Legitimacy: ${legitimacy}`);\nconsole.log('─'.repeat(66) + '\\n');\n","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/gemini-eval.mjs#L582-L618","documentation":"After the report and TSV addition are saved successfully, gemini-eval.mjs spawns merge-tracker.mjs via execFileSync with a 30s timeout to merge the tracker addition into data/applications.md. If the merge subprocess fails — non-zero exit, timeout, node not spawning — this warning is printed, exitCode becomes 1, and the tracker row stays unmerged. The report and the TSV file in batch/tracker-additions/ are intact, so the merge can be retried manually without re-evaluating.","triggerScenarios":"execFileSync(process.execPath, [merge-tracker.mjs]) throwing: merge-tracker.mjs exits non-zero (duplicate row detection, malformed TSV header, locked tracker file), the 30s timeout elapses on a slow disk/large tracker, or spawn fails (EMFILE, missing node binary at process.execPath).","commonSituations":"A tracker addition whose company+role already exists and is judged a duplicate by merge-tracker.mjs; a stale lock file left by a crashed earlier merge; malformed header in the generated TSV (missing required labels); running many parallel evaluations causing lock contention or the 30s timeout to fire.","solutions":["Read merge-tracker.mjs's own error output (rerun manually: node merge-tracker.mjs) — it prints why the addition was skipped (duplicate, bad header, lock).","If it was a duplicate, that's often correct: update the existing tracker row instead (node set-status.mjs) rather than adding a new one.","If it was a lock, remove the stale lock or wait for the concurrent run to finish, then re-run node merge-tracker.mjs to pick up the pending TSV.","If it was a timeout, rerun the merge manually — the addition TSV is already on disk in batch/tracker-additions/."],"exampleFix":"// manual recovery — the TSV is already saved\n// before (re-running the whole evaluation)\nnode gemini-eval.mjs ...\n// after (merge only)\nnode merge-tracker.mjs\n# or, if duplicate:\nnode set-status.mjs <report#|company> <State> --note \"updated existing row\"","handlingStrategy":"retry","validationCode":"// before relying on auto-merge, check the pending addition is well-formed and not a duplicate\nnode check-table-freshness.mjs --summary   # tracker sanity\ngrep -i \"<company>\" data/applications.md     # existing row?\nhead -2 batch/tracker-additions/<file>.tsv   # header row present?","typeGuard":null,"tryCatchPattern":"try {\n  execFileSync(process.execPath, [mergeTracker], { stdio: 'pipe', timeout: 30000 });\n} catch (err) {\n  if (err.killed) console.warn('merge timed out — rerun: node merge-tracker.mjs');\n  else console.warn(`merge failed (exit ${err.status}): ${err.stderr?.toString()}`);\n  // the TSV in batch/tracker-additions/ is intact; merging can be retried safely\n}","preventionTips":["Check for an existing tracker row with the same company+role before evaluating — update it with set-status.mjs instead of adding a duplicate.","Avoid running many gemini-eval workers concurrently on the same repo; reserve report numbers and stagger merges.","After any failed auto-merge, always run node merge-tracker.mjs manually — the TSV addition survives on disk.","Include req/posting IDs in notes when a company has multiple same-title openings, so the merge dedup doesn't misfire."],"tags":["subprocess","merge","tracker","nodejs"],"backgroundTag":"command-not-found","analyzedSha":"aac998c7ed7248ea853b720ceeb1fdbeb322fc5d","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}