santifer/career-ops · warning

⚠️ Failed to sync PDF flags

Error message

⚠️  Failed to sync PDF flags: ${e.message}

What it means

After writing the merged tracker, merge-tracker.mjs invokes sync-pdf-flags.mjs (in a separate child process with its own lock/transaction) to reconcile the tracker's PDF ✅/❌ column with the actual files in output/. A child-process failure is non-fatal — the merge itself succeeded — so it's surfaced as a warning with the exception message, not a crash.

Solutions

  1. Read the child's inherited stderr (printed above the warning) for the underlying cause and fix that first.
  2. Re-run node sync-pdf-flags.mjs manually once the lock is free — it is idempotent.
  3. Check no other merge-tracker/set-status process is holding the shared lock; retry after it exits.
  4. Verify sync-pdf-flags.mjs exists at CAREER_OPS_CODE_ROOT (reinstall/update career-ops if missing).

Example fix

// diagnosis
$ node sync-pdf-flags.mjs
Error: lock held by pid 1234
// after
$ wait 1234; node sync-pdf-flags.mjs   # idempotent re-run, flags now synced
Defensive patterns

Strategy: try-catch

Validate before calling

try { execFileSync(process.execPath, [syncPath, '--check'], { stdio: 'pipe' }); } catch (e) { console.error('sync-pdf-flags will fail:', e.message); }

Try / catch

try {
  execFileSync(process.execPath, [join(CAREER_OPS_CODE_ROOT, 'sync-pdf-flags.mjs')], { stdio: 'inherit' });
} catch (e) {
  console.warn(`⚠️  Failed to sync PDF flags: ${e.message}`);
  // re-run manually once the lock frees: node sync-pdf-flags.mjs
}

Prevention

When it happens

Trigger: execFileSync on process.execPath exits non-zero: sync-pdf-flags.mjs threw, the file is missing from CAREER_OPS_CODE_ROOT, the tracker lock is held by another process, or Node itself failed to spawn.

Common situations: Concurrent merge/set-status runs contending for the tracker lock; a partial install missing sync-pdf-flags.mjs; a syntax error or crash inside sync-pdf-flags.mjs on a malformed tracker row.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/8cff5aa6aca35dc8. Report an issue: GitHub.

Appendix: source

Thrown at merge-tracker.mjs:1817

  // is written.
  if (!existsSync(MERGED_DIR)) mkdirSync(MERGED_DIR, { recursive: true });
  const archivable = tsvFiles.filter(f => !failedAdditions.includes(f));
  for (const file of archivable) {
    renameSync(join(ADDITIONS_DIR, file), join(MERGED_DIR, file));
  }
  console.log(`\n✅ Moved ${archivable.length} TSVs to merged/`);
}

console.log(`\n📊 Summary: +${added} added, 🔄${updated} updated, ⏭️${skipped} skipped${failedAdditions.length ? `, ❌${failedAdditions.length} NOT merged` : ''}`);
if (DRY_RUN) console.log('(dry-run — no changes written)');
trackerLock.release();

// Sync PDF flags (idempotent; uses its own lock/transaction)
if (!DRY_RUN) {
  try {
    execFileSync(process.execPath, [join(CAREER_OPS_CODE_ROOT, 'sync-pdf-flags.mjs')], { stdio: 'inherit' });
  } catch (e) {
    console.warn(`⚠️  Failed to sync PDF flags: ${e.message}`);
  }
}

// Optional verify
if (VERIFY && !DRY_RUN) {
  console.log('\n--- Running verification ---');
  try {
    execFileSync(process.execPath, [join(CAREER_OPS_CODE_ROOT, 'verify-pipeline.mjs')], { stdio: 'inherit' });
  } catch (e) {
    process.exit(1);
  }
}

// Any addition that could not be applied fails the run. The TSVs stay in the
// additions dir, so re-running after the tracker is repaired merges them once.
if (failedAdditions.length > 0) {
  console.error(
    `\n❌ ${failedAdditions.length} addition(s) were NOT merged and were left in ${ADDITIONS_DIR}: ` +

View on GitHub (pinned to aac998c7ed)