{"record":{"id":"459c972137036069","repo":"santifer/career-ops","slug":"skipping-filename-invalid-entry-number","errorCode":null,"errorMessage":"⚠️  Skipping ${filename}: invalid entry number","messagePattern":"⚠️  Skipping (.+?): invalid entry number","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"merge-tracker.mjs","lineNumber":932,"sourceCode":"function parseTsvContent(content, filename) {\n  // Split the RAW content: trimming the whole file strips the data row's\n  // trailing tab, and that tab IS the final empty cell (`…\\tnotes\\t` for an\n  // absent url). Trimming first made a row's last column disappear, so the\n  // width check then read the row as one cell short of its own header.\n  const rawLines = String(content ?? '').split(/\\r?\\n/).filter(l => l.trim() !== '');\n  content = String(content ?? '').trim();\n  if (!content) return null;\n\n  // Headed additions resolve by name; everything below is the legacy positional\n  // path, unchanged — it keeps parsing the trimmed content, byte-for-byte as\n  // before. Detection reads only the first line.\n  if (looksLikeTsvHeaderRow(splitAdditionCells(rawLines[0]))) {\n    const headed = parseHeadedAddition(rawLines, filename);\n    if (!headed) return null;\n    // Number.isSafeInteger rather than isNaN: parseTrackerNum returns null for a\n    // cell that is not a whole positive integer, and isNaN(null) is false.\n    if (!Number.isSafeInteger(headed.num) || headed.num <= 0) {\n      console.warn(`⚠️  Skipping ${filename}: invalid entry number`);\n      return null;\n    }\n    return headed;\n  }\n\n  let parts;\n  let addition;\n\n  // Detect pipe-delimited (markdown table row)\n  if (content.startsWith('|')) {\n    parts = content.split('|').map(s => s.trim());\n    if (parts[0] === '') parts.shift();\n    if (parts[parts.length - 1] === '') parts.pop();\n    if (parts.length < 8) {\n      console.warn(`⚠️  Skipping malformed pipe-delimited ${filename}: ${parts.length} fields`);\n      return null;\n    }\n    // Format: num | date | company | role | score | status | pdf | report | notes [| location]","sourceCodeStart":914,"sourceCodeEnd":950,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/merge-tracker.mjs#L914-L950","documentation":"After a headed addition parses, its entry number must be a safe positive integer — parseTrackerNum returns null for a cell that is not a whole positive integer, and the check uses Number.isSafeInteger because isNaN(null) is false. A file whose num cell is missing, non-numeric, zero, or negative is skipped so a row without a usable tracker number cannot corrupt applications.md.","triggerScenarios":"parseTsvContent (merge-tracker.mjs:931): headed.num is null (parseTrackerNum failed on a non-integer string like '042a', 'N/A', ''), <= 0, or exceeds Number.MAX_SAFE_INTEGER. The header parsed fine and the row mapped, but the num cell itself is unusable.","commonSituations":"The num cell was left blank or filled with a placeholder like 'TODO'; a zero-padded value got mangled ('042-' with a trailing dash); the writer put the report number where the entry number belongs or vice versa; a spreadsheet exported the num column as text with formatting characters.","solutions":["Set the num cell to the intended whole positive integer (the tracker entry number, zero-padded 3-digit form like 042 is fine).","If no number is assigned yet, reserve one first (node reserve-report-num.mjs or the next max+1 in the tracker) and write that.","Confirm you are not putting the report file number in the wrong column — num is the tracker entry number.","Strip any non-numeric characters (units, dashes, notes) from the num cell."],"exampleFix":"// before\nnum\tdate\tcompany\trole\tscore\tstatus\tpdf\treport\nTODO\t2026-09-16\tAcme\tBackend\t4.2/5\tEvaluated\t❌\t[042](reports/042.md)\n\n// after\nnum\tdate\tcompany\trole\tscore\tstatus\tpdf\treport\n42\t2026-09-16\tAcme\tBackend\t4.2/5\tEvaluated\t❌\t[042](reports/042.md)","handlingStrategy":"validation","validationCode":"const num = Number.parseInt(cells[header.indexOf('num')], 10);\nif (!Number.isSafeInteger(num) || num <= 0) {\n  throw new Error(`${file}: entry number must be a whole positive integer, got \"${cells[header.indexOf('num')]}\"`);\n}","typeGuard":"const isValidTrackerNum = (v) => {\n  const n = Number(v);\n  return Number.isSafeInteger(n) && n > 0;\n};","tryCatchPattern":null,"preventionTips":["Assign the tracker number before writing the addition file — reserve it via reserve-report-num.mjs when parallelizing.","Never leave the num cell as a placeholder (TODO, N/A, blank); placeholders belong in score/report, and even there only as documented sentinels.","Don't conflate the report file number with the tracker entry number — check which one the column wants.","Validate the num cell with a regex (^\\d+$) in the emitter before writing the file."],"tags":["tsv","parsing","merge-tracker","entry-number"],"backgroundTag":"invalid-identifier-format","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"}