santifer/career-ops · error · Error
Failed to read profile file at
Error message
Failed to read profile file at ${customProfilePath}: ${err.message} What it means
loadProfile() wraps any failure while reading or parsing an explicitly supplied custom profile file (readFileSync throw, YAML syntax error, or the inner invalid-YAML check) into this single error, preserving the underlying message. It exists so callers get one consistent message naming the offending path.
Solutions
- Read the wrapped err.message suffix — it contains the root cause (ENOENT, EACCES, YAML syntax detail, or invalid YAML).
- Paste the file into a YAML linter/parser to find the syntax error (tabs, bad indentation, unclosed strings).
- Check file permissions and that the path is a regular file, not a directory.
- Restore a known-good copy from config/profile.example.yml or version control.
Example fix
// before mykey: "unclosed value // after mykey: "unclosed value"
Defensive patterns
Strategy: try-catch
Try / catch
try {
const profile = loadProfile(customPath);
} catch (err) {
if (err.message.includes(`Failed to read profile file at ${customPath}`)) {
console.error(`Root cause: ${err.message}`); // suffix carries the underlying read/parse error
// fall back to default: loadProfile(null)
} else throw err;
} Prevention
- Lint YAML files (no tabs, consistent 2-space indentation) in CI.
- Check file permissions and that the path is a regular file before passing it in.
- Restore broken profiles from config/profile.example.yml rather than hand-patching syntax.
When it happens
Trigger: loadProfile(customProfilePath) where the file exists but readFileSync fails (permissions, it is a directory) or yaml.load throws a syntax error, or the parsed result is not a non-null object.
Common situations: YAML indentation/tab errors; wrong permissions on the file; passing a directory path instead of a file; invalid characters or unclosed quotes/brackets in the YAML; the empty-file case from the inner invalid-YAML throw.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Failed to read profile file at
- arbeitsagentur: entry
- Cannot read benchmarks at
- config/profile.yml is empty or invalid YAML: fill it in…
- ⚠️ Could not parse config/profile.yml
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/d4914ce49c1bc586.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/export-ats-text.mjs:230
* Loads profile and CV data from file paths or default paths.
* Fails closed if real profile configuration is missing.
*/
export function loadProfile(customProfilePath = null, customCvPath = null) {
let profileRaw = null;
const profileSource = customProfilePath || process.env.CAREER_OPS_PROFILE || 'config/profile.yml';
if (customProfilePath) {
if (!existsSync(customProfilePath)) {
throw new Error(`Profile configuration file not found at: ${customProfilePath}`);
}
try {
const content = readFileSync(customProfilePath, 'utf8');
profileRaw = yaml.load(content);
if (!profileRaw || typeof profileRaw !== 'object') {
throw new Error(`Invalid YAML in profile file: ${customProfilePath}`);
}
} catch (err) {
throw new Error(`Failed to read profile file at ${customProfilePath}: ${err.message}`);
}
} else {
if (!existsSync(profileSource)) {
throw new Error('config/profile.yml not found: fill it in first');
}
try {
const content = readFileSync(profileSource, 'utf8');
profileRaw = yaml.load(content);
if (!profileRaw || typeof profileRaw !== 'object') {
throw new Error('config/profile.yml is empty or invalid YAML: fill it in first');
}
} catch (err) {
throw new Error(`Failed to read profile file at ${profileSource}: ${err.message}`);
}
}
let cvData = {};
const cvSource = customCvPath || process.env.CAREER_OPS_CV || 'cv.md';View on GitHub (pinned to aac998c7ed)