santifer/career-ops · error · Error

agentic-jobs: invalid URL: ${url}

Error message

agentic-jobs: invalid URL: ${url}

What it means

The agentic-jobs provider (agentic-engineering-jobs.com) validates its API URL via assertAgenticUrl(). This first guard throws if `new URL(url)` fails — a malformed/empty/no-protocol string. It precedes the protocol and hostname checks.

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 9b17a8ac97)

Solutions

  1. Inspect API_BASE at the top of providers/agentic-jobs.mjs — it must be a complete absolute URL (e.g. 'https://agentic-engineering-jobs.com/api').
  2. Ensure any entry URL override is a valid absolute https URL.

Example fix

// before
const API_BASE = 'agentic-engineering-jobs.com/api';

// after
const API_BASE = 'https://agentic-engineering-jobs.com/api';
Defensive patterns

Strategy: validation

Validate before calling

function assertValidUrl(url) {
  try { new URL(url); return true; } catch { return false; }
}
if (!assertValidUrl(API_BASE)) throw new Error('agentic-jobs API_BASE is not a valid URL');

Type guard

/** @param {unknown} u @returns {u is string} */
function isValidUrlString(u) {
  if (typeof u !== 'string' || u.length === 0) return false;
  try { new URL(u); return true; } catch { return false; }
}

Try / catch

try { assertAgenticUrl(url); } catch (err) {
  if (/invalid URL/.test(err.message)) console.error('agentic-jobs API_BASE malformed — fix it.');
  throw err;
}

Prevention

When it happens

Trigger: API_BASE (the compiled-in base) or a supplied URL fails URL parsing: empty string, 'agentic-engineering-jobs.com/api' without a scheme, undefined, or control characters. API_BASE is a trusted constant, so this typically means a bad edit to that constant.

Common situations: API_BASE edited to drop the https:// scheme; partial URL pasted.

Related errors


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