santifer/career-ops · warning

⚠️ Tracker # already used; assigning # to — . Report link…

Error message

⚠️  Tracker #${addition.num} already used; assigning #${entryNum} to ${addition.company} — ${addition.role}. Report link remains ${addition.report}.

What it means

When a tracker addition's requested number (addition.num) is already occupied by an existing row, merge-tracker.mjs does not overwrite it: it assigns the next free number (maxNum+1, skipping used ones) and warns. The report link stays pointing at the original report file — only the tracker row number differs.

Solutions

  1. Confirm the newly numbered row's report link still points at the intended report in reports/ — content is intact, only the # changed.
  2. For parallel workers, reserve ranges first with node reserve-report-num.mjs --count N and hand each worker its own number.
  3. Re-run node merge-tracker.mjs — merges are idempotent and renumbering warnings resolve once numbers are unique.
  4. Fix the generator to derive num from a reserved range instead of max+1.

Example fix

// before (race)
const num = maxExisting + 1;
// after
$ node reserve-report-num.mjs --count 4
// prints e.g. 042-045; hand one number to each worker
Defensive patterns

Strategy: validation

Validate before calling

const used = new Set(existingRows.map(r => r.num));
if (used.has(num)) console.warn(`#${num} already used — reserve a number with node reserve-report-num.mjs`);

Type guard

const isFreeNumber = (num, used) => !used.has(num);

Prevention

When it happens

Trigger: Two workers or two merge runs both computed/claimed the same tracker # (e.g. both used max+1 without coordination), or the TSV's num collides with a row added since the TSV was generated.

Common situations: Parallel batch fan-outs that skipped reserve-report-num.mjs and each computed max+1 (#749 race); re-running a merge after another addition claimed the number; a hand-written TSV reusing an existing row number.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


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

Appendix: source

Thrown at merge-tracker.mjs:1708

      console.error(
        `❌ ${file}: could not locate tracker row #${duplicate.num} ` +
        `(${duplicate.company} — ${duplicate.role}) to update; this evaluation was NOT merged.`,
      );
      failedAdditions.push(file);
    }
  } else {
    // New entry - preserve the TSV's reserved ID whenever it is actually
    // free. Parallel workers can finish out of order, so a valid reservation
    // may be lower than the current tracker maximum (#1733). Renumber only on
    // a real collision, using the next free ID above the current maximum and
    // warning loudly so report/tracker drift is visible (#1704).
    let entryNum;
    if (!usedNumbers.has(addition.num)) {
      entryNum = addition.num;
    } else {
      entryNum = maxNum + 1;
      while (usedNumbers.has(entryNum)) entryNum++;
      console.warn(
        `⚠️  Tracker #${addition.num} already used; assigning #${entryNum} to ` +
        `${addition.company} — ${addition.role}. Report link remains ${addition.report}.`,
      );
    }
    usedNumbers.add(entryNum);
    if (entryNum > maxNum) maxNum = entryNum;

    const pdf = reportNum && pdfIndex.has(String(reportNum)) ? '✅' : addition.pdf;
    const newLine = buildRow({
      num: entryNum, date: addition.date, company: addition.company, role: addition.role,
      via: addition.via || '—',
      location: addition.location || '—',
      score: addition.score, status: addition.status, pdf,
      report: addition.report, notes: addition.notes,
      // Write the key on the way in. Backfill is the one-time EXPAND phase for
      // rows that predate the column; a row added today must carry its own URL
      // or Pass 0 can never match it and dedup stays fuzzy-only for new work.
      url: addition.url || '',

View on GitHub (pinned to aac998c7ed)