{"record":{"id":"bb1e8e034bdef2ea","repo":"santifer/career-ops","slug":"sort-must-be-date-or-score","errorCode":null,"errorMessage":"--sort must be date or score","messagePattern":"--sort must be date or score","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"company-funded.mjs","lineNumber":129,"sourceCode":"    const arg = argv[i];\n    if (arg === '--dry-run') opts.dryRun = true;\n    else if (arg === '--json') opts.json = true;\n    else if (arg === '--self-test') opts.selfTest = true;\n    else if (arg === '--help' || arg === '-h') opts.help = true;\n    else if (arg === '--limit') opts.limit = Number(argv[++i] || '');\n    else if (arg === '--months') opts.months = Number(argv[++i] || '');\n    else if (arg === '--sort') opts.sort = String(argv[++i] || '').trim().toLowerCase();\n    else if (arg === '--sources') opts.sources = parseSources(argv[++i] || '');\n    else throw new Error(`unknown option: ${arg}`);\n  }\n  if (!Number.isInteger(opts.limit) || opts.limit <= 0 || opts.limit > 100) {\n    throw new Error('--limit must be an integer from 1 to 100');\n  }\n  if (!Number.isInteger(opts.months) || opts.months <= 0 || opts.months > 120) {\n    throw new Error('--months must be an integer from 1 to 120');\n  }\n  if (!['date', 'score'].includes(opts.sort)) {\n    throw new Error('--sort must be date or score');\n  }\n  return opts;\n}\n\nfunction parseSources(value) {\n  const out = String(value || '')\n    .split(',')\n    .map((s) => normalizeSourceName(s.trim()))\n    .filter(Boolean);\n  const unique = [...new Set(out)];\n  const allowed = new Set(['techcrunch', 'prnewswire', 'guardian', 'hn']);\n  for (const source of unique) {\n    if (!allowed.has(source)) throw new Error(`unknown source in --sources: ${source}`);\n  }\n  return unique.length ? unique : [...DEFAULT_SOURCES];\n}\n\nfunction normalizeSourceName(value) {","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/company-funded.mjs#L111-L147","documentation":"Error \"--sort must be date or score\" thrown in santifer/career-ops.","triggerScenarios":"Thrown at company-funded.mjs:129 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use --sort date or --sort score."],"exampleFix":"node company-funded.mjs --sort date","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}