{"record":{"id":"a3bf66c34d7630f9","repo":"santifer/career-ops","slug":"cannot-read-benchmarks-at-path-err-message","errorCode":null,"errorMessage":"Cannot read benchmarks at ${path}: ${err.message}","messagePattern":"Cannot read benchmarks at (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"funnel-velocity.mjs","lineNumber":228,"sourceCode":"      median: days.length >= HOP_MIN_N ? median(days) : null,\n      p75: days.length >= HOP_MIN_N ? p75(days) : null,\n      insufficientData: days.length < HOP_MIN_N,\n      sameDayExcluded,\n      censored,\n    };\n  }\n  return result;\n}\n\n// --- Benchmarks ---\nexport function loadBenchmarks(explicitPath) {\n  const path = explicitPath\n    || (existsSync(join(CAREER_OPS, 'config/benchmarks.yml')) ? join(CAREER_OPS, 'config/benchmarks.yml') : join(CAREER_OPS, 'templates/benchmarks.yml'));\n  let doc;\n  try {\n    doc = yaml.load(readFileSync(path, 'utf-8'));\n  } catch (err) {\n    throw new Error(`Cannot read benchmarks at ${path}: ${err.message}`);\n  }\n  if (!doc || typeof doc.benchmarks !== 'object' || doc.benchmarks === null) {\n    throw new Error(`Malformed benchmarks file at ${path}: expected a top-level \"benchmarks\" map`);\n  }\n  return { benchmarks: doc.benchmarks, path };\n}\n\n/** Classify an own-rate percentage against a benchmark's range (inclusive). */\nexport function classify(ownPct, metric) {\n  if (ownPct === null || ownPct === undefined || !metric || !Array.isArray(metric.range_pct)) return null;\n  const [lo, hi] = metric.range_pct;\n  const band = ownPct < lo ? 'below-range' : ownPct > hi ? 'above-range' : 'within-range';\n  const typical = metric.typical_pct;\n  return {\n    band,\n    ownPct,\n    rangePct: [lo, hi],\n    typicalPct: typical ?? null,","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/funnel-velocity.mjs#L210-L246","documentation":"loadBenchmarks resolves the benchmarks file (--benchmarks path > config/benchmarks.yml > templates/benchmarks.yml) and calls yaml.load(readFileSync(path)). This error wraps any failure in that step: file not found, permission denied, or a YAML syntax error. The wrapped err.message distinguishes ENOENT from YAMLException.","triggerScenarios":"All three candidate paths are missing (deleted templates/benchmarks.yml); --benchmarks points to a non-existent file; the YAML has a syntax error (bad indentation, unclosed quote); permission denied on the file.","commonSituations":"User deletes templates/ without realizing benchmarks.yml lives there; a custom config/benchmarks.yml has invalid YAML; wrong CWD so the relative default path misses; a git operation removed the file.","solutions":["Verify the file exists: ls templates/benchmarks.yml (or your custom path).","Validate the YAML syntax: node -e \"require('js-yaml').load(require('fs').readFileSync('templates/benchmarks.yml','utf-8'))\".","If using --benchmarks, confirm the path is correct and readable.","Restore templates/benchmarks.yml from git if deleted: git checkout HEAD -- templates/benchmarks.yml."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { existsSync, readFileSync } from 'fs';\nimport * as yaml from 'js-yaml';\n\nfunction validateBenchmarksFile(path) {\n  if (!existsSync(path)) throw new Error(`Benchmarks file not found: ${path}`);\n  let doc;\n  try {\n    doc = yaml.load(readFileSync(path, 'utf-8'));\n  } catch (err) {\n    throw new Error(`YAML syntax error in ${path}: ${err.message}`);\n  }\n  return doc;\n}","typeGuard":null,"tryCatchPattern":"import { loadBenchmarks } from './funnel-velocity.mjs';\n\ntry {\n  const { benchmarks, path } = loadBenchmarks();\n} catch (err) {\n  console.error(`Benchmark load failed: ${err.message}`);\n  // Restore from git or fix the file\n  process.exit(1);\n}","preventionTips":["Keep templates/benchmarks.yml under version control and restore it if deleted.","Validate custom config/benchmarks.yml with a YAML linter before committing.","If using --benchmarks, verify the path resolves before running."],"tags":["config","yaml","filesystem","benchmarks"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}