santifer/career-ops · error · Error

torre: invalid experience

Error message

torre: invalid experience "${configured}" — must be one of: ${[...EXPERIENCE_LEVELS].join(', ')}

What it means

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.

Solutions

  1. 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
  2. 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)
  3. Check casing and exact token spelling against the list printed in the error message
  4. 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

Example fix

// before (portals.yml)
- provider: torre
  search: engineering manager
  experience: senior
// after
- provider: torre
  search: engineering manager
  experience: 5-plus-years   # or omit to use the '1-plus-year' default
Defensive patterns

Strategy: validation

Validate before calling

const EXPERIENCE_LEVELS = new Set(['potential-to-develop','1-plus-year','2-plus-years','3-plus-years','5-plus-years']);
function isValidExperience(v) {
  return typeof v !== 'string' || v.trim() === '' || EXPERIENCE_LEVELS.has(v.trim());
}
// empty/absent is fine (falls back to default); only non-empty invalid values throw

Type guard

const isTorreExperience = (v) => typeof v === 'string' && ['potential-to-develop','1-plus-year','2-plus-years','3-plus-years','5-plus-years'].includes(v.trim());

Try / catch

try {
  const body = buildTorreQuery(entry);
} catch (err) {
  if (err.message.includes('invalid experience')) {
    console.error(`${entry.name}: ${err.message} — fix portals.yml or remove the field to use the default`);
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/c58453ce1942c9bb. Report an issue: GitHub.

Appendix: source

Thrown at providers/torre.mjs:116

/**
 * Build the search body from the portal entry. Only filters proven to affect
 * `total` are emitted — see the header note. Exported for tests.
 *
 * @param {any} entry
 * @returns {object}
 */
export function buildTorreQuery(entry) {
  /** @type {Record<string, unknown>} */
  const body = {};

  const search = typeof entry?.search === 'string' ? entry.search.trim() : '';
  if (search) {
    // `experience` is mandatory here — omitting it is a hard 500, so it is
    // always emitted alongside `text` rather than being conditional on config.
    const configured = typeof entry?.experience === 'string' ? entry.experience.trim() : '';
    if (configured && !EXPERIENCE_LEVELS.has(configured)) {
      throw new Error(
        `torre: invalid experience "${configured}" — must be one of: ${[...EXPERIENCE_LEVELS].join(', ')}`,
      );
    }
    body['skill/role'] = { text: search, experience: configured || DEFAULT_EXPERIENCE };
  }

  // Only the positive case is expressible: `{"remote":{"term":false}}` is not a
  // verified filter, so a falsy remote_only sends no key at all rather than a
  // filter that might be ignored while looking effective.
  if (entry?.remote_only === true) body.remote = { term: true };

  return body;
}

/**
 * Normalize a single Torre opportunity. Exported for tests.
 *
 * Field mapping → the normalized Job shape:

View on GitHub (pinned to aac998c7ed)