{"record":{"id":"bdd859769b78e3dd","repo":"santifer/career-ops","slug":"cv-file-not-found-at-customcvpath","errorCode":null,"errorMessage":"CV file not found at: ${customCvPath}","messagePattern":"CV file not found at: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/export-ats-text.mjs","lineNumber":251,"sourceCode":"    if (!existsSync(profileSource)) {\n      throw new Error('config/profile.yml not found: fill it in first');\n    }\n    try {\n      const content = readFileSync(profileSource, 'utf8');\n      profileRaw = yaml.load(content);\n      if (!profileRaw || typeof profileRaw !== 'object') {\n        throw new Error('config/profile.yml is empty or invalid YAML: fill it in first');\n      }\n    } catch (err) {\n      throw new Error(`Failed to read profile file at ${profileSource}: ${err.message}`);\n    }\n  }\n\n  let cvData = {};\n  const cvSource = customCvPath || process.env.CAREER_OPS_CV || 'cv.md';\n  if (customCvPath) {\n    if (!existsSync(customCvPath)) {\n      throw new Error(`CV file not found at: ${customCvPath}`);\n    }\n    try {\n      const cvText = readFileSync(customCvPath, 'utf8');\n      cvData = parseCvMarkdown(cvText);\n    } catch (err) {\n      throw new Error(`Failed to read CV file at ${customCvPath}: ${err.message}`);\n    }\n  } else if (existsSync(cvSource)) {\n    try {\n      const cvText = readFileSync(cvSource, 'utf8');\n      cvData = parseCvMarkdown(cvText);\n    } catch {\n      // cv.md is optional if profile supplies necessary fields\n    }\n  }\n\n  return normalizeProfile(profileRaw, cvData);\n}","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/scripts/export-ats-text.mjs#L233-L269","documentation":"Thrown by loadProfile() when an explicitly supplied customCvPath (second argument) does not exist on disk. The CV is optional (default cv.md is skipped silently if absent), but an explicitly requested CV file must exist — hence the fail-fast check before reading.","triggerScenarios":"Calling loadProfile(profilePath, 'cv_old.md') where that CV file is missing: typo, deleted file, wrong cwd for a relative path, or an env-var CAREER_OPS_CV pointing nowhere when passed through.","commonSituations":"Renamed cv.md to something else; running the export script from a subdirectory; CI missing the CV artifact; pointing at a CV in another repo that was not cloned.","solutions":["Verify the path exists: ls the exact customCvPath value and correct typos.","Use path.resolve() for an absolute path so it does not depend on the current working directory.","Pass null to fall back to the default cv.md (which is silently optional) if a CV is not required.","Check the CAREER_OPS_CV env var resolves to an existing file before passing it through."],"exampleFix":"// before\nconst profile = loadProfile(null, 'cv.md'); // cwd is scripts/, file is at repo root\n// after\nconst profile = loadProfile(null, path.resolve(__dirname, '..', 'cv.md'));","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nconst cvPath = path.resolve(__dirname, 'cv.md');\nif (!existsSync(cvPath)) {\n  console.warn(`CV not found at ${cvPath}; proceeding without CV data`);\n}\nconst profile = loadProfile(null, existsSync(cvPath) ? cvPath : null);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass absolute, path.resolve()'d CV paths — never cwd-relative strings.","Remember a CV is optional: pass null to fall back to the silently-skipped default cv.md.","Keep cv.md at the repo root and don't rename it without updating callers.","Ensure CI checks out/generates cv.md before running export scripts."],"tags":["cv","file-not-found","config"],"backgroundTag":"file-not-found","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"}