santifer/career-ops · error · Error

manfred: invalid URL: ${url}

Error message

manfred: invalid URL: ${url}

What it means

assertManfredUrl runs the value through new URL(); if construction throws (not an absolute parseable URL), this error fires. It is the first of three guards (parse → HTTPS → trusted host) for the Manfred (getmanfred.com) feed.

Source

Thrown at providers/manfred.mjs:33

//      between a usable provider and an unusable one.
//   2. `lang` is REQUIRED: without it the API answers 400 with
//      `"lang must be one of the following values: EN, ES"`.
//
// Wire in via a `job_boards:` entry with `provider: manfred`.

const FEED_BASE = 'https://www.getmanfred.com/api/v2/public/offers';
const TRUSTED_HOST = 'www.getmanfred.com';
const OFFER_BASE = 'https://www.getmanfred.com/ofertas-empleo';
const VALID_LANGS = ['EN', 'ES'];
const DEFAULT_LANG = 'EN';

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

/** Resolve the feed language: `lang` on the entry, uppercased, else EN. */
export function resolveLang(entry) {
  const raw = typeof entry?.lang === 'string' ? entry.lang.trim().toUpperCase() : '';
  return VALID_LANGS.includes(raw) ? raw : DEFAULT_LANG;
}

// The feed reports currency as the SYMBOL, not an ISO code, and the observed
// values include a narrow-no-break-space variant of the euro sign. scan.mjs's
// salary_filter compares currencies case-insensitively as plain strings, so a
// symbol would never match a user's `currency: EUR` — map to ISO, and drop the

View on GitHub (pinned to 9b17a8ac97)

Solutions

  1. Read the value in the message and ensure it is a full absolute URL.
  2. Provide all parameters needed to build the Manfred feed URL (the base is https://www.getmanfred.com/api/v2/public/offers).
  3. Trim whitespace from any config value feeding the URL.

Example fix

// before
feedUrl = 'www.getmanfred.com/api/v2/public/offers'

// after
feedUrl = 'https://www.getmanfred.com/api/v2/public/offers'
Defensive patterns

Strategy: validation

Validate before calling

import { URL } from 'node:url';
export function isValidAbsoluteUrl(value) {
  if (typeof value !== 'string' || !value) return false;
  try { new URL(value); return true; } catch { return false; }
}
// Pre-validate any manfred api:/feed URL in the config loader before runtime.

Type guard

/** @param {string} url */
function isParseableUrl(url) {
  try { new URL(url); return true; } catch { return false; }
}

Try / catch

try {
  assertManfredUrl(candidate);
} catch (err) {
  console.warn(`manfred URL invalid for ${entry.name}: ${err.message}`);
  entry.disabled = true;
}

Prevention

When it happens

Trigger: The URL passed to assertManfredUrl is empty, relative, missing a scheme ('www.getmanfred.com/...'), or otherwise rejected by the URL constructor. assertManfredUrl is applied to FEED_URL-derived and offer URLs.

Common situations: A constructed Manfred URL was built from a missing/blank parameter; an api: field in portals.yml lacks https://; a templated URL had an undefined segment producing an unparseable string.

Related errors


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