{"record":{"id":"cac05b757216c1ea","repo":"santifer/career-ops","slug":"failed-to-parse-profile-yml-err-message","errorCode":null,"errorMessage":"⚠️   Failed to parse profile.yml: ${err.message}","messagePattern":"⚠️   Failed to parse profile\\.yml: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"openai-tailor.mjs","lineNumber":330,"sourceCode":"// Clean up markdown block wrapping if the LLM adds it despite instructions\ntailoredHtml = tailoredHtml.replace(/^\\s*```(html)?\\s*/i, '').replace(/\\s*```\\s*$/, '');\n\n// ---------------------------------------------------------------------------\n// Save tailored HTML\n// ---------------------------------------------------------------------------\ntry {\n  if (!existsSync(PATHS.output)) {\n    mkdirSync(PATHS.output, { recursive: true });\n  }\n\n  let candidateName = 'candidate';\n  try {\n    const profile = yaml.load(profileContent);\n    if (profile && profile.name) {\n      candidateName = profile.name;\n    }\n  } catch (err) {\n    console.warn(`⚠️   Failed to parse profile.yml: ${err.message}`);\n  }\n  candidateName = candidateName\n    .toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');\n\n  const filename = `cv-${candidateName}-${companySlug}.html`;\n  const htmlPath = join(PATHS.output, filename);\n\n  writeFileSync(htmlPath, tailoredHtml, 'utf-8');\n  console.log(`\\n✅  Tailored HTML saved: ${htmlPath}`);\n\n  // Print next steps\n  const pdfFilename = `cv-${candidateName}-${companySlug}-${roleSlug}-${new Date().toISOString().split('T')[0]}.pdf`;\n  const reportNumMatch = reportFilename.match(/^(\\d+)-/);\n  const reportNum = reportNumMatch ? reportNumMatch[1] : '001';\n\n  console.log(`\\n📄  Next step (generate PDF):\\n    node generate-pdf.mjs output/${filename} output/${pdfFilename} --format=letter --report=${reportNum}\\n`);\n\n} catch (err) {","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/openai-tailor.mjs#L312-L348","documentation":"Warning from openai-tailor.mjs when yaml.load on config/profile.yml throws (invalid YAML syntax or non-object result). The script falls back to a default candidateName, so CV generation continues but the output filename uses a placeholder name instead of the user's.","triggerScenarios":"config/profile.yml contains YAML syntax errors (bad indentation, unquoted colons, tabs), is empty, or yaml package cannot parse the content.","commonSituations":"User hand-edited profile.yml and broke indentation; pasted values containing ':' without quoting; file saved with tabs instead of spaces; partial merge of a template.","solutions":["Fix YAML syntax in config/profile.yml (validate with `node -e \"require('yaml').load(require('fs').readFileSync('config/profile.yml','utf8'))\"`)","Replace tabs with spaces and quote strings containing ':'","Restore from config/profile.example.yml and re-apply your settings","If intentional, ignore the warning — generation continues with fallback name"],"exampleFix":"// before\nname: Career Ops: User   # unquoted colon -> parse error\n// after\nname: \"Career Ops User\"","handlingStrategy":"validation","validationCode":"import { load } from 'yaml';\nconst doc = load(readFileSync('config/profile.yml', 'utf8'));\nif (!doc || typeof doc !== 'object') throw new Error('profile.yml is not a YAML object');\nif (typeof doc.name !== 'string' || !doc.name.trim()) console.warn('profile.yml missing name; filename will use fallback');","typeGuard":"function isParsedProfile(v) { return v !== null && typeof v === 'object' && !Array.isArray(v); }","tryCatchPattern":"try { profile = yaml.load(profileContent); } catch (err) { console.warn(`⚠️ Failed to parse profile.yml: ${err.message}`); profile = {}; }","preventionTips":["Validate profile.yml after every hand edit (yaml linter or node one-liner)","Use spaces, never tabs, in YAML files","Quote any string value containing ':' or '#'","Keep config/profile.example.yml as a recovery baseline"],"tags":["yaml","config","nodejs"],"backgroundTag":"yaml-parse-error","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"}