santifer/career-ops · error · Error

agentic-jobs: invalid URL

Error message

agentic-jobs: invalid URL: ${url}

What it means

assertAgenticUrl in providers/agentic-jobs.mjs throws this when the URL passed to the agentic-jobs provider cannot be parsed by the URL constructor. The provider validates feed URLs in three stages — parse, HTTPS, trusted hostname — and this is the first stage, rejecting syntactically invalid URL strings before any fetch is attempted.

Solutions

  1. Repair the URL so it is a valid absolute URL (add the scheme, remove stray characters/whitespace).
  2. Check the config source for unset variables or leftover placeholders.
  3. Run `new URL(url)` in a REPL to reproduce the parse error and pinpoint the malformed part.

Example fix

// before
fetchAgenticJobs(url) // url = 'agenticjobs.dev/api' — no scheme
// after
fetchAgenticJobs('https://agenticjobs.dev/api')
Defensive patterns

Strategy: validation

Validate before calling

try { new URL(rawUrl); } catch { throw new Error(`invalid agentic-jobs feed URL: ${rawUrl}`); }

Type guard

function isParsableUrl(s) {
  try { new URL(s); return true; } catch { return false; }
}

Try / catch

try {
  await fetchAgenticJobs(url);
} catch (e) {
  if (String(e.message).startsWith('agentic-jobs: invalid URL')) {
    console.error(`Malformed feed URL in config: ${url}`);
    return null;
  } else throw e;
}

Prevention

When it happens

Trigger: new URL(url) throws for the given string: missing scheme, empty string, illegal characters, spaces, or a non-URL config value (path fragment, placeholder like '${FEED_URL}' left unsubstituted).

Common situations: portals.yml entry missing 'https://'; YAML multi-line folding inserting whitespace; unset env var interpolating 'undefined' into the URL; copy-paste dropping part of the URL.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at providers/agentic-jobs.mjs:45

// boards; MAX_PAGES is a hard stop regardless.
//
// Wire in via a `job_boards:` entry with `provider: agentic-jobs`.

const SITE_ORIGIN = 'https://agentic-engineering-jobs.com';
const API_BASE = `${SITE_ORIGIN}/api/v1`;
const TRUSTED_HOST = 'agentic-engineering-jobs.com';
const PAGE_SIZE = 50; // fixed by the API (meta.per_page)
const MAX_PAGES = 40; // safety cap on request count (40*50 = 2000 postings)
const MAX_JOBS = 2000;
const PAGE_DELAY_MS = 2100; // stays under the documented 30 req/60s limit

/** @param {string} url */
function assertAgenticUrl(url) {
  let parsed;
  try {
    parsed = new URL(url);
  } catch {
    throw new Error(`agentic-jobs: invalid URL: ${url}`);
  }
  if (parsed.protocol !== 'https:') throw new Error(`agentic-jobs: URL must use HTTPS: ${url}`);
  if (parsed.hostname !== TRUSTED_HOST) {
    throw new Error(`agentic-jobs: untrusted hostname "${parsed.hostname}" — must be ${TRUSTED_HOST}`);
  }
  return url;
}

const regionNames = new Intl.DisplayNames(['en'], { type: 'region' });

/**
 * Resolve a two-letter ISO country code to an English name. Returns '' for
 * anything that isn't a resolvable two-letter code. Exported for tests.
 * @param {unknown} code
 */
export function countryName(code) {
  if (typeof code !== 'string' || !/^[A-Za-z]{2}$/.test(code)) return '';
  try {

View on GitHub (pinned to aac998c7ed)