santifer/career-ops · warning
⚠️ Failed to parse profile.yml
Error message
⚠️ Failed to parse profile.yml: ${err.message} What it means
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.
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
Example fix
// before name: Career Ops: User # unquoted colon -> parse error // after name: "Career Ops User"
Defensive patterns
Strategy: validation
Validate before calling
import { load } from 'yaml';
const doc = load(readFileSync('config/profile.yml', 'utf8'));
if (!doc || typeof doc !== 'object') throw new Error('profile.yml is not a YAML object');
if (typeof doc.name !== 'string' || !doc.name.trim()) console.warn('profile.yml missing name; filename will use fallback'); Type guard
function isParsedProfile(v) { return v !== null && typeof v === 'object' && !Array.isArray(v); } Try / catch
try { profile = yaml.load(profileContent); } catch (err) { console.warn(`⚠️ Failed to parse profile.yml: ${err.message}`); profile = {}; } Prevention
- 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
When it happens
Trigger: config/profile.yml contains YAML syntax errors (bad indentation, unquoted colons, tabs), is empty, or yaml package cannot parse the content.
Common situations: 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.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- arbeitsagentur: entry
- Cannot read benchmarks at
- config/profile.yml is empty or invalid YAML: fill it in…
- ⚠️ Could not parse config/profile.yml
- Failed to read profile file at
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/cac05b757216c1ea.
Report an issue: GitHub.
Appendix: source
Thrown at openai-tailor.mjs:330
// Clean up markdown block wrapping if the LLM adds it despite instructions
tailoredHtml = tailoredHtml.replace(/^\s*```(html)?\s*/i, '').replace(/\s*```\s*$/, '');
// ---------------------------------------------------------------------------
// Save tailored HTML
// ---------------------------------------------------------------------------
try {
if (!existsSync(PATHS.output)) {
mkdirSync(PATHS.output, { recursive: true });
}
let candidateName = 'candidate';
try {
const profile = yaml.load(profileContent);
if (profile && profile.name) {
candidateName = profile.name;
}
} catch (err) {
console.warn(`⚠️ Failed to parse profile.yml: ${err.message}`);
}
candidateName = candidateName
.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
const filename = `cv-${candidateName}-${companySlug}.html`;
const htmlPath = join(PATHS.output, filename);
writeFileSync(htmlPath, tailoredHtml, 'utf-8');
console.log(`\n✅ Tailored HTML saved: ${htmlPath}`);
// Print next steps
const pdfFilename = `cv-${candidateName}-${companySlug}-${roleSlug}-${new Date().toISOString().split('T')[0]}.pdf`;
const reportNumMatch = reportFilename.match(/^(\d+)-/);
const reportNum = reportNumMatch ? reportNumMatch[1] : '001';
console.log(`\n📄 Next step (generate PDF):\n node generate-pdf.mjs output/${filename} output/${pdfFilename} --format=letter --report=${reportNum}\n`);
} catch (err) {View on GitHub (pinned to aac998c7ed)