{"record":{"id":"78e262ecf818177f","repo":"santifer/career-ops","slug":"could-not-save-report-err-message","errorCode":null,"errorMessage":"⚠️   Could not save report: ${err.message}","messagePattern":"⚠️   Could not save report: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"gemini-eval.mjs","lineNumber":441,"sourceCode":"      writeFileSync(reportPath, reportContent, 'utf-8');\n      mkdirSync(PATHS.trackerAdditions, { recursive: true });\n      const trackerFields = [\n        String(parseInt(num, 10)),\n        today,\n        tsvSafe(company),\n        tsvSafe(role),\n        'Evaluated',\n        normalizedTrackerScore(score),\n        '❌',\n        `[${num}](reports/${filename})`,\n        'Gemini evaluation',\n      ];\n      writeFileSync(trackerPath, `${trackerFields.join('\\t')}\\n`, 'utf-8');\n      console.log(`\\n✅  Report saved: reports/${filename}`);\n      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(ROOT, 'merge-tracker.mjs')], {\n          cwd: ROOT,\n          encoding: 'utf-8',\n          stdio: ['ignore', 'pipe', 'pipe'],\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 {","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/santifer/career-ops/blob/60398d6549a46f5266929538af21cfab94badc75/gemini-eval.mjs#L423-L459","documentation":"Best-effort warning in gemini-eval.mjs's report-save phase: writing the report file to reports/ or the tracker-addition TSV to batch/tracker-additions/ failed, so evaluation output is not persisted and exitCode is set to 1. The original filesystem error (EACCES, ENOENT directory missing, invalid filename characters from the company slug, disk full) is appended to the message.","triggerScenarios":"Running gemini-eval when reports/ or batch/tracker-additions/ does not exist or is read-only; a company name whose slug produces an illegal filename on the filesystem; ENOSPC. The catch keeps going to the finally block that releases reserved report numbers.","commonSituations":"Fresh or partial clones missing gitignored output dirs; running as a user without write permission to the repo; exotic characters (slashes, colons on Windows) in the scraped company name; full disks in containers.","solutions":["Create the missing directories: `mkdir -p reports batch/tracker-additions`","Check the appended errno in the message — EACCES means fix permissions, ENOSPC means free space","Re-run the evaluation (the reservation is released in finally, so the report number is not leaked)","If the company name is the problem, sanitize or manually add the entry per the tracker TSV conventions"],"exampleFix":"# before\nnode gemini-eval.mjs \"<jd>\"   # reports/ absent -> Could not save report: ENOENT\n# after\nmkdir -p reports batch/tracker-additions && node gemini-eval.mjs \"<jd>\"","handlingStrategy":"try-catch","validationCode":"import { accessSync, constants, mkdirSync } from 'node:fs';\nfor (const dir of ['reports', 'batch/tracker-additions']) {\n  mkdirSync(dir, { recursive: true });\n  accessSync(dir, constants.W_OK); // throws early with a clear EACCES instead of mid-eval\n}","typeGuard":null,"tryCatchPattern":"try {\n  saveReport();\n} catch (err) {\n  if (['ENOENT', 'EACCES', 'ENOSPC'].includes(err.code)) {\n    // report did not persist: fix fs issue, re-run evaluation; reservation is released in finally\n    console.error(`report not saved (${err.code}); safe to re-run`);\n    process.exitCode = 1;\n  } else {\n    throw err;\n  }\n}","preventionTips":["Pre-create reports/ and batch/tracker-additions/ in setup scripts and CI","Run as a user with write access to the repo; watch disk space in containers","Treat exitCode 1 after this warning as 'not persisted' and always re-run rather than assuming success"],"tags":["file-write","report-persistence","filesystem","gemini-eval"],"backgroundTag":"file-write-failed","analyzedSha":"60398d6549a46f5266929538af21cfab94badc75","analyzedAt":"2026-08-20T23:00:06.764Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}