{"record":{"id":"ffd4b80537015409","repo":"santifer/career-ops","slug":"profile-configuration-file-not-found-at-customp","errorCode":null,"errorMessage":"Profile configuration file not found at: ${customProfilePath}","messagePattern":"Profile configuration file not found at: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/export-ats-text.mjs","lineNumber":221,"sourceCode":"    education = raw.education;\n  } else if (Array.isArray(cvData.education) && cvData.education.length > 0) {\n    education = cvData.education;\n  }\n\n  return { name, email, phone, location, linkedin, summary, experience, education, skills };\n}\n\n/**\n * Loads profile and CV data from file paths or default paths.\n * Fails closed if real profile configuration is missing.\n */\nexport function loadProfile(customProfilePath = null, customCvPath = null) {\n  let profileRaw = null;\n  const profileSource = customProfilePath || process.env.CAREER_OPS_PROFILE || 'config/profile.yml';\n\n  if (customProfilePath) {\n    if (!existsSync(customProfilePath)) {\n      throw new Error(`Profile configuration file not found at: ${customProfilePath}`);\n    }\n    try {\n      const content = readFileSync(customProfilePath, 'utf8');\n      profileRaw = yaml.load(content);\n      if (!profileRaw || typeof profileRaw !== 'object') {\n        throw new Error(`Invalid YAML in profile file: ${customProfilePath}`);\n      }\n    } catch (err) {\n      throw new Error(`Failed to read profile file at ${customProfilePath}: ${err.message}`);\n    }\n  } else {\n    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') {","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/scripts/export-ats-text.mjs#L203-L239","documentation":"loadProfile() in scripts/export-ats-text.mjs throws this when an explicitly passed customProfilePath (first argument) does not exist on disk. It is a fail-fast pre-flight check before attempting to read/parse the file. It applies only to the explicit custom path branch; the default config/profile.yml path has its own distinct error.","triggerScenarios":"Calling loadProfile('/path/to/profile.yml') or loadProfile(customProfilePath='...') where the file does not exist (typo, wrong cwd, deleted file, never created).","commonSituations":"Typo in the CLI --profile flag path; running from a different working directory so a relative path no longer resolves; profile file renamed or moved during a refactor; CI job missing a checkout/copy step for the profile.","solutions":["Verify the path exists: run ls on the exact customProfilePath value and fix typos.","Pass an absolute path (or resolve relative to the repo root) instead of a cwd-relative one.","Set the CAREER_OPS_PROFILE env var to a valid path and pass null instead of a bad customProfilePath.","Create the profile file by copying config/profile.example.yml to the intended location and filling it in."],"exampleFix":"// before\nconst profile = loadProfile('config/profil.yml'); // typo\n// after\nconst profile = loadProfile(path.resolve(__dirname, 'config/profile.yml'));","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nif (!existsSync(profilePath)) throw new Error(`Profile not found: ${path.resolve(profilePath)}`);\nconst profile = loadProfile(profilePath);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always resolve profile paths with path.resolve() so they are independent of cwd.","Check existsSync() before calling loadProfile with a custom path.","Keep profile files out of gitignore if CI needs them, or add a checkout/copy step.","Prefer the CAREER_OPS_PROFILE env var or default config/profile.yml over ad-hoc custom paths."],"tags":["config","file-not-found","profile"],"backgroundTag":"config-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"}