santifer/career-ops · error · Error

remotli: invalid URL: ${url}

Error message

remotli: invalid URL: ${url}

What it means

assertRemotliUrl throws this when new URL(url) raises — the string is not a parseable absolute URL. This is the structural guard before the HTTPS and hostname checks. remotli builds paginated API URLs internally, so this typically means the constructed URL string is malformed.

Source

Thrown at providers/remotli.mjs:238

  const description = htmlToText(job.description);
  if (description) out.description = description;

  const postedAt = toEpochMs(job.publishedAt || job.createdAt);
  if (postedAt !== undefined) out.postedAt = postedAt;

  const salary = resolveSalary(job);
  if (salary) out.salary = salary;

  return out;
}

/** Guard the API URL: HTTPS + remotli.ch only. */
function assertRemotliUrl(url) {
  let parsed;
  try {
    parsed = new URL(url);
  } catch {
    throw new Error(`remotli: invalid URL: ${url}`);
  }
  if (parsed.protocol !== 'https:') throw new Error(`remotli: URL must use HTTPS: ${url}`);
  if (!HOST_RE.test(parsed.hostname))
    throw new Error(`remotli: untrusted hostname "${parsed.hostname}" — must be remotli.ch`);
  return url;
}

/** @type {Provider} */
export default {
  id: 'remotli',

  detect(entry) {
    const raw = typeof entry.careers_url === 'string' ? entry.careers_url : '';
    if (!raw) return null;
    let parsed;
    try {
      parsed = new URL(raw);
    } catch {

View on GitHub (pinned to 9b17a8ac97)

Solutions

  1. Inspect the exact URL string passed to assertRemotliUrl — log it before the call.
  2. Verify ORIGIN starts with 'https://' and API_PATH begins with '/'.
  3. Check that page/limit values used in the template literal are valid numbers, not NaN or undefined.
  4. Revert recent changes to the URL-building constants.

Example fix

// before — ORIGIN missing scheme
const ORIGIN = 'remotli.ch';
// after
const ORIGIN = 'https://remotli.ch';
Defensive patterns

Strategy: validation

Validate before calling

function isParseableUrl(s) {
  try { new URL(s); return true; } catch { return false; }
}
// remotli builds URLs from constants — validate the constants at startup
if (!isParseableUrl(`${ORIGIN}${API_PATH}`)) {
  throw new Error('remotli: ORIGIN/API_PATH misconfigured — URL will not parse');
}

Type guard

null

Try / catch

try {
  await provider.fetch(entry, ctx);
} catch (e) {
  if (/remotli: invalid URL/.test(e.message)) {
    console.error(`[bug] remotli URL construction broken: ${e.message}`);
  } else throw e;
}

Prevention

When it happens

Trigger: The URL passed to assertRemotliUrl has no protocol, contains illegal characters, or is otherwise rejected by the URL constructor. Since remotli constructs URLs from ORIGIN + API_PATH constants, a corrupt ORIGIN constant or a bad page/limit interpolation would trigger it.

Common situations: The ORIGIN or API_PATH constant was edited incorrectly (missing scheme, typo); template-literal interpolation produced an empty or malformed segment; a code change broke the URL-building logic.

Related errors


AI-assisted analysis of santifer/career-ops@9b17a8ac97 (2026-08-13). Data as JSON: /api/errors/8dd31ba274c30c28. Report an issue: GitHub.