{"record":{"id":"5ad05eafdb67eb8c","repo":"santifer/career-ops","slug":"tracker-parse-mjs-cannot-load-tracker-aliases-jso","errorCode":null,"errorMessage":"tracker-parse.mjs: cannot load tracker-aliases.json (${e.message}). The file ships with career-ops next to tracker-parse.mjs — restore it from the repo or re-run: node update-system.mjs apply","messagePattern":"tracker-parse\\.mjs: cannot load tracker-aliases\\.json \\((.+?)\\)\\. The file ships with career-ops next to tracker-parse\\.mjs — restore it from the repo or re-run: node update-system\\.mjs apply","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"tracker-parse.mjs","lineNumber":40,"sourceCode":"/**\n * Header text (lowercased) → canonical field name. Includes ES aliases.\n * Loaded from tracker-aliases.json — the ONE shared alias table, which the web\n * read path (web/src/lib/tracker-table.mjs) also loads at runtime, so the two\n * can never drift (PR #1598 review). Add new aliases in the JSON, not here.\n *\n * A missing or corrupt JSON is a broken install (the file ships alongside this\n * module in SYSTEM_PATHS/BOOTSTRAP_PATHS): fail fast with an actionable\n * message rather than degrading silently — a quiet fallback here would\n * reintroduce exactly the reader drift the shared table exists to prevent.\n * (The web loader degrades to the legacy fixed order instead because it reads\n * the file from a user-configured root at request time.)\n */\nexport const HEADER_ALIASES = (() => {\n  const src = new URL('./tracker-aliases.json', import.meta.url);\n  try {\n    return JSON.parse(readFileSync(src, 'utf-8'));\n  } catch (e) {\n    throw new Error(\n      `tracker-parse.mjs: cannot load tracker-aliases.json (${e.message}). ` +\n      'The file ships with career-ops next to tracker-parse.mjs — restore it ' +\n      'from the repo or re-run: node update-system.mjs apply',\n    );\n  }\n})();\n\n/**\n * A score cell in the tracker: `N/5` or `N.N/5` (any precision), or the\n * sentinels `N/A` / `DUP` / `—` (em dash) / `-` (hyphen). Markdown bold is\n * stripped first. `—`/`-` mirror the tracker's own \"no data\" convention used\n * in every other column (Report, PDF, etc.) — see #1799: a backfilled entry\n * with no evaluation (e.g. a rejection for a role never run through\n * `oferta`) needs a score-cell sentinel too, not just `N/A`. A status label\n * never matches this, which is what makes it a reliable discriminator between\n * the score and status columns regardless of their order (#1427).\n */\nexport const SCORE_CELL_RE = /^\\d+(?:\\.\\d+)?\\/5$/;","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/tracker-parse.mjs#L22-L58","documentation":"tracker-parse.mjs loads its alias table (HEADER_ALIASES) from tracker-aliases.json at module init via an import.meta.url-relative readFileSync. If that JSON is missing or unreadable, the module cannot map tracker column names, so it throws immediately at import time instead of failing later on a mis-parsed tracker. The file ships with career-ops next to tracker-parse.mjs.","triggerScenarios":"Any import/require of tracker-parse.mjs when tracker-aliases.json is absent from the module directory, was deleted, or cannot be read (permissions, partial update checkout, packaging that dropped JSON assets).","commonSituations":"Partial git checkout or sparse clone that skipped JSON files; a system update that replaced tracker-parse.mjs but not its companion data file; copying the .mjs file alone to another location; npm/packaging rules that exclude .json siblings; restrictive file permissions after running as another user.","solutions":["Run `node update-system.mjs apply` to restore shipped system files including tracker-aliases.json","Restore tracker-aliases.json from the career-ops repo (git checkout -- tracker-aliases.json or re-download next to tracker-parse.mjs)","Check file permissions on tracker-aliases.json (readable by the running user)","Verify the file parses as JSON (node -e \"JSON.parse(require('fs').readFileSync('tracker-aliases.json','utf-8'))\") to rule out truncation/corruption"],"exampleFix":"// before\ncp tracker-parse.mjs ~/tools/   # copied script without its JSON companion -> throws at import\n// after\ncp tracker-parse.mjs tracker-aliases.json ~/tools/  # keep both files together","handlingStrategy":"fallback","validationCode":"import { existsSync } from 'fs';\nif (!existsSync(new URL('./tracker-aliases.json', import.meta.url))) {\n  throw new Error('tracker-aliases.json missing; run: node update-system.mjs apply');\n}","typeGuard":"const isAliasFileOk = (dir) => existsSync(join(dir, 'tracker-aliases.json'));","tryCatchPattern":"try {\n  const { HEADER_ALIASES } = await import('./tracker-parse.mjs');\n} catch (e) {\n  if (String(e.message).includes('tracker-aliases.json')) {\n    // restore shipped files then re-import\n  }\n}","preventionTips":["Keep tracker-parse.mjs and tracker-aliases.json together when copying or bundling","Run node doctor.mjs / update-system.mjs check after pulling system updates","Include .json assets in packaging/bundle configuration","Verify repo checkout completeness with git status after clone/sync"],"tags":["module-init","missing-file","json","config"],"backgroundTag":"module-init-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"}