{"record":{"id":"49fc81e781042275","repo":"santifer/career-ops","slug":"warning-failed-to-append-to-status-log-tsv-for-num-err","errorCode":null,"errorMessage":"Warning: failed to append to status-log.tsv for #${num}: ${err.message}","messagePattern":"Warning: failed to append to status-log\\.tsv for #(.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"reply-watch.mjs","lineNumber":326,"sourceCode":"      const count = r.count > 1 ? ` (${r.count} replies)` : '';\n      console.log(`  #${r.num} ${r.company} (${r.role}): ${r.oldStatus} → ${r.newStatus}${count}`);\n    });\n    console.log('');\n\n    const answer = await askQuestion(`Apply recommended status updates to ${APPS_FILE}? (y/N): `);\n    if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {\n      const statusLogFile = path.join(path.dirname(APPS_FILE), 'status-log.tsv');\n      const todayStr = localToday();\n\n      const result = await updateTrackerStatuses(updates, (applied, updatesByNum) => {\n        for (const num of applied) {\n          const u = updatesByNum.get(num);\n          if (u) {\n            const line = `${num}\\t${todayStr}\\t${u.oldStatus}\\t${u.newStatus}\\treply-watch\\t\\n`;\n            try {\n              fs.appendFileSync(statusLogFile, line, 'utf-8');\n            } catch (err) {\n              console.warn(`Warning: failed to append to status-log.tsv for #${num}: ${err.message}`);\n            }\n          }\n        }\n      });\n      for (const r of updates) {\n        const count = r.count > 1 ? ` (${r.count} replies)` : '';\n        if (result.applied.has(r.num)) {\n          console.log(`Updated #${r.num} to ${r.newStatus}${count}`);\n        } else if (result.alreadyCurrent.has(r.num)) {\n          console.log(`No change for #${r.num}: already ${r.newStatus}${count}`);\n        } else if (result.conflicts.has(r.num)) {\n          console.warn(`Skipped #${r.num}: status changed from ${r.oldStatus} to ${result.conflicts.get(r.num)} during review`);\n        } else if (result.missing.has(r.num)) {\n          console.warn(`Skipped #${r.num}: row no longer exists in the tracker`);\n        }\n      }\n      console.log('\\n✅ Tracker review complete');\n","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/reply-watch.mjs#L308-L344","documentation":"Warning in reply-watch.mjs's main: after classifying replies and computing tracker status updates, the script appends each transition to data/status-log.tsv via fs.appendFileSync; if that append fails, the warning is logged per report number and processing continues. The tracker update itself still happens — only the historical ledger entry is lost.","triggerScenarios":"appendFileSync to data/status-log.tsv fails: the file exists but is read-only, data/ is missing (no prior write created it), path is a directory, or disk is full (ENOSPC).","commonSituations":"Fresh checkout where data/status-log.tsv and sometimes data/ don't exist; running in a read-only CI workspace; disk quota exceeded.","solutions":["Check err.message for the fs error code","Ensure data/ exists and status-log.tsv is writable: mkdir -p data && touch data/status-log.tsv","Fix disk/permission issues indicated by ENOSPC/EACCES","Recovering the lost ledger rows: re-run the classification or append the transitions manually in {num}\\t{date}\\t{from}\\t{to}\\treply-watch\\t form"],"exampleFix":"// before\ntry { fs.appendFileSync(statusLogFile, line, 'utf-8'); }\ncatch (err) { console.warn(`Warning: failed to append to status-log.tsv for #${num}: ${err.message}`); }\n// after\nfs.mkdirSync(dirname(statusLogFile), { recursive: true });\ntry { fs.appendFileSync(statusLogFile, line, 'utf-8'); }\ncatch (err) { console.warn(`Warning: failed to append to status-log.tsv for #${num}: ${err.message}`); }","handlingStrategy":"try-catch","validationCode":"import { mkdirSync, appendFileSync } from 'fs';\nmkdirSync(dirname(statusLogFile), { recursive: true });\ntry { appendFileSync(statusLogFile, ''); } catch (e) { console.error('status-log.tsv not writable:', e.message); }","typeGuard":"function isFsError(e) { return e instanceof Error && typeof e.code === 'string'; }","tryCatchPattern":"try { fs.appendFileSync(statusLogFile, line, 'utf-8'); } catch (err) { console.warn(`Warning: failed to append for #${num}: ${err.message}`); /* tracker update already applied; log loss is non-fatal */ }","preventionTips":["Create data/status-log.tsv during onboarding/doctor runs","Run pipeline scripts from the repo root","Keep the ledger append-only and never chmod it read-only","If a ledger row is lost, reconstruct it from tracker status history"],"tags":["nodejs","filesystem","status-log","tracker"],"backgroundTag":"file-write-failed","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"}