santifer/career-ops · error · Error

solidjobs: invalid URL: ${url}

Error message

solidjobs: invalid URL: ${url}

What it means

assertUrl wraps new URL(entry.careers_url) in try/catch and throws 'solidjobs: invalid URL' when the constructor cannot parse the string. This is the first of four sequential validations in assertUrl (parse → https → host → path); it fires before the host/path checks, so the value is not even a syntactically valid URL.

Source

Thrown at providers/solidjobs.mjs:25

// Available divisions: it, engineering, marketing, sales, hr, logistics, finances, other
// API docs: https://solid.jobs/public-api/offers/{division}?campaign={campaign}

const ALLOWED_HOSTS = new Set(['solid.jobs']);

/**
 * Validates that the provided URL is a trusted SolidJobs API endpoint.
 * Enforces HTTPS protocol, strict hostname matching, and required path prefix.
 * 
 * @param {string} url - The URL string to validate.
 * @returns {string} The validated URL string.
 * @throws {Error} If the URL is malformed, uses non-HTTPS, has an untrusted host, or wrong path.
 */
function assertUrl(url) {
  let parsed;
  try {
    parsed = new URL(url);
  } catch {
    throw new Error(`solidjobs: invalid URL: ${url}`);
  }
  if (parsed.protocol !== 'https:') throw new Error(`solidjobs: URL must use HTTPS: ${url}`);
  if (!ALLOWED_HOSTS.has(parsed.hostname))
    throw new Error(`solidjobs: untrusted hostname "${parsed.hostname}" — must be solid.jobs`);
  if (!parsed.pathname.startsWith('/public-api/offers/'))
    throw new Error(`solidjobs: URL path must start with /public-api/offers/: ${url}`);
  return url;
}

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

  /**
   * Attempts to detect if the provider can handle the given entry by checking the careers_url.
   * * @param {{ careers_url?: string, name?: string }} entry - The configuration entry.
   * @returns {{url: string} | null} An object with the matched URL, or null if not matched.
   */

View on GitHub (pinned to 9b17a8ac97)

Solutions

  1. Prefix the value with https:// so it is an absolute URL
  2. Quote the scalar in portals.yml if it contains special characters
  3. Trim stray whitespace/quotes around the URL
  4. Use the full form https://solid.jobs/public-api/offers/<division>

Example fix

# before
- name: SolidJobs IT
careers_url: solid.jobs/public-api/offers/it
# after
- name: SolidJobs IT
careers_url: https://solid.jobs/public-api/offers/it
Defensive patterns

Strategy: validation

Validate before calling

// Reject malformed careers_url before the provider fetches.
function isValidUrl(v) {
  if (typeof v !== 'string' || !v) return false;
  try { new URL(v); return true; } catch { return false; }
}
if (!isValidUrl(entry.careers_url)) {
  console.warn(`${entry.name}: careers_url is not a valid absolute URL`);
}

Type guard

/** @param {unknown} v @returns {v is string} */
function isValidUrl(v) {
  if (typeof v !== 'string' || !v) return false;
  try { new URL(v); return true; } catch { return false; }
}

Prevention

When it happens

Trigger: entry.careers_url is a non-empty string that new URL rejects: missing scheme (e.g. 'solid.jobs/public-api/offers/it'), contains spaces or stray characters, or is a malformed paste. (An empty/missing value is caught earlier by the 'careers_url required' guard at line 62.)

Common situations: YAML typo, a copy-paste that dropped the 'https://' scheme, an unquoted YAML scalar parsed oddly, or a trailing/leading whitespace artifact.

Related errors


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