{"record":{"id":"c58453ce1942c9bb","repo":"santifer/career-ops","slug":"torre-invalid-experience-configured-must-b","errorCode":null,"errorMessage":"torre: invalid experience \"${configured}\" — must be one of: ${[...EXPERIENCE_LEVELS].join(', ')}","messagePattern":"torre: invalid experience \"(.+?)\" — must be one of: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/torre.mjs","lineNumber":116,"sourceCode":"\n/**\n * Build the search body from the portal entry. Only filters proven to affect\n * `total` are emitted — see the header note. Exported for tests.\n *\n * @param {any} entry\n * @returns {object}\n */\nexport function buildTorreQuery(entry) {\n  /** @type {Record<string, unknown>} */\n  const body = {};\n\n  const search = typeof entry?.search === 'string' ? entry.search.trim() : '';\n  if (search) {\n    // `experience` is mandatory here — omitting it is a hard 500, so it is\n    // always emitted alongside `text` rather than being conditional on config.\n    const configured = typeof entry?.experience === 'string' ? entry.experience.trim() : '';\n    if (configured && !EXPERIENCE_LEVELS.has(configured)) {\n      throw new Error(\n        `torre: invalid experience \"${configured}\" — must be one of: ${[...EXPERIENCE_LEVELS].join(', ')}`,\n      );\n    }\n    body['skill/role'] = { text: search, experience: configured || DEFAULT_EXPERIENCE };\n  }\n\n  // Only the positive case is expressible: `{\"remote\":{\"term\":false}}` is not a\n  // verified filter, so a falsy remote_only sends no key at all rather than a\n  // filter that might be ignored while looking effective.\n  if (entry?.remote_only === true) body.remote = { term: true };\n\n  return body;\n}\n\n/**\n * Normalize a single Torre opportunity. Exported for tests.\n *\n * Field mapping → the normalized Job shape:","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/torre.mjs#L98-L134","documentation":"Torre's search API requires that any skill/role text filter carry a companion `experience` enum value; an unrecognized value is rejected server-side. buildTorreQuery validates the configured entry.experience against the EXPERIENCE_LEVELS allowlist ('potential-to-develop', '1-plus-year', '2-plus-years', '3-plus-years', '5-plus-years') and throws this error for anything else, failing fast client-side instead of getting a live API 500.","triggerScenarios":"A job_boards entry with a torre provider sets `search` (or equivalent text) plus an `experience` value that is not one of the five allowed strings — e.g. experience: 'senior', '5+ years', 'expert', or a value with different casing like '1-Plus-Year'. Only entries WITH a search term reach this check; entries without search never touch experience.","commonSituations":"Writing the experience as free text ('senior level', '10 years') instead of the API's exact enum token, using '+ ' instead of '-plus-' formatting, casing mistakes, or copying experience values from a different job API that uses a different enum vocabulary.","solutions":["Replace the configured experience with one of the exact allowed values: potential-to-develop, 1-plus-year, 2-plus-years, 3-plus-years, 5-plus-years","Delete the experience field entirely — the provider then falls back to the default '1-plus-year' (the enum is required by the API but inert for filtering, so the default is fine)","Check casing and exact token spelling against the list printed in the error message","If a new level appears in Torre's API, add it to EXPERIENCE_LEVELS in providers/torre.mjs and confirm live that the API accepts it before relying on it"],"exampleFix":"// before (portals.yml)\n- provider: torre\n  search: engineering manager\n  experience: senior\n// after\n- provider: torre\n  search: engineering manager\n  experience: 5-plus-years   # or omit to use the '1-plus-year' default","handlingStrategy":"validation","validationCode":"const EXPERIENCE_LEVELS = new Set(['potential-to-develop','1-plus-year','2-plus-years','3-plus-years','5-plus-years']);\nfunction isValidExperience(v) {\n  return typeof v !== 'string' || v.trim() === '' || EXPERIENCE_LEVELS.has(v.trim());\n}\n// empty/absent is fine (falls back to default); only non-empty invalid values throw","typeGuard":"const isTorreExperience = (v) => typeof v === 'string' && ['potential-to-develop','1-plus-year','2-plus-years','3-plus-years','5-plus-years'].includes(v.trim());","tryCatchPattern":"try {\n  const body = buildTorreQuery(entry);\n} catch (err) {\n  if (err.message.includes('invalid experience')) {\n    console.error(`${entry.name}: ${err.message} — fix portals.yml or remove the field to use the default`);\n    return;\n  }\n  throw err;\n}","preventionTips":["Copy enum tokens verbatim (dash-separated, lowercase) from the error message or provider source","Prefer omitting the experience field entirely — the default '1-plus-year' satisfies the API","Keep a comment in portals.yml listing the five legal values next to any torre entry","Validate config at load time with an allowlist check before running scans"],"tags":["enum","config","validation","api-contract"],"backgroundTag":"invalid-enum-value","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"}