{"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":"exception","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/1696bec4d021768e7359f9aad6b329cba883da20/scripts/export-ats-text.mjs#L203-L239","documentation":"loadProfile in scripts/export-ats-text.mjs resolves the profile from, in order, an explicit customProfilePath argument, CAREER_OPS_PROFILE, or config/profile.yml. When the caller passes an explicit customProfilePath, the function requires that exact file to exist and fails closed with this message otherwise. Unlike the default path, a missing explicit path is treated as a caller mistake, not an uninitialized setup.","triggerScenarios":"loadProfile('/path/to/my-profile.yml') where that file does not exist — e.g. a typo'd or relative path resolved from the wrong working directory, a profile file deleted/renamed after being referenced, or a script passing a path variable that was never populated.","commonSituations":"Running the ATS exporter from a different cwd so a relative path no longer resolves; pointing CAREER_OPS_PROFILE or an argument at a teammate's path; renamed profile during repo restructuring; CI checkout missing the gitignored personal profile.","solutions":["Check the path with fs.existsSync(customProfilePath) and correct the typo or pass an absolute path (path.resolve).","Run the script from the repository root, or make the path absolute relative to the repo root instead of the process cwd.","If the profile was meant to be the default, drop the argument and let it fall back to CAREER_OPS_PROFILE / config/profile.yml.","In CI, ensure the personal profile file is present (secret/artifact step) before invoking the exporter."],"exampleFix":"// before\nloadProfile('config/my-profile.yml'); // run from another cwd\n\n// after\nimport path from 'node:path';\nconst p = path.resolve(process.cwd(), 'config/my-profile.yml');\nif (!existsSync(p)) throw new Error(`Profile missing: ${p}`);\nloadProfile(p);","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nimport path from 'node:path';\nconst p = path.resolve(process.cwd(), profileArg);\nif (!existsSync(p)) throw new Error(`Profile not found: ${p} (cwd=${process.cwd()})`);\nloadProfile(p);","typeGuard":"function hasReadableFile(p) {\n  try { return existsSync(p) && statSync(p).isFile(); } catch { return false; }\n}","tryCatchPattern":"try {\n  const profile = loadProfile(customPath);\n} catch (e) {\n  if (e.message.startsWith('Profile configuration file not found')) {\n    console.error(`Fix --profile path: ${e.message}. Falling back to config/profile.yml.`);\n    return loadProfile(null);\n  }\n  throw e;\n}","preventionTips":["Run CLI scripts from the repository root or convert all config paths to absolute with path.resolve.","existsSync-check custom paths in your wrapper script before calling loadProfile.","Don't reference gitignored personal files from CI unless a setup step materializes them."],"tags":["filesystem","configuration","missing-file","path-resolution"],"backgroundTag":"config-file-not-found","analyzedSha":"1696bec4d021768e7359f9aad6b329cba883da20","analyzedAt":"2026-09-01T19:19:23.111Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}