santifer/career-ops · error · Error

solidjobs: invalid URL

Error message

solidjobs: invalid URL: ${url}

What it means

assertUrl in providers/solidjobs.mjs throws this when the URL cannot be parsed by the URL constructor — it is not a syntactically valid absolute URL. The provider validates entry.careers_url before fetching, so a malformed URL is rejected with this explicit message instead of a generic fetch failure.

Solutions

  1. Add the missing scheme — use https://solid.jobs/public-api/offers/<division>
  2. Trim whitespace/newlines from the configured careers_url value
  3. Check YAML quoting so the full URL lands in one string value
  4. Use one of the documented division slugs (it, engineering, marketing, sales, hr, logistics, finances, other) so the path segment is valid

Example fix

// before
careers_url: 'solid.jobs/public-api/offers/it'  // no scheme
// after
careers_url: 'https://solid.jobs/public-api/offers/it'
Defensive patterns

Strategy: validation

Validate before calling

function isValidSolidjobsUrl(url) {
  try { new URL(url); return true; } catch { return false; }
}
if (entry.provider === 'solidjobs' && !isValidSolidjobsUrl(entry.careers_url)) {
  throw new Error(`solidjobs careers_url is not a valid URL: ${entry.careers_url}`);
}

Type guard

const isParseableUrl = (v) => {
  if (typeof v !== 'string') return false;
  try { new URL(v); return true; } catch { return false; }
};

Try / catch

try {
  await solidjobsProvider.fetch(entry, ctx);
} catch (e) {
  if (String(e.message).includes('invalid URL')) {
    console.error(`Entry ${entry.name}: careers_url is malformed — needs absolute https://solid.jobs/... form`);
  } else throw e;
}

Prevention

When it happens

Trigger: A solidjobs portals entry whose careers_url is missing the scheme ('solid.jobs/public-api/offers/it'), contains spaces or invalid characters, or is empty/undefined stringified; calling assertUrl directly with user input that isn't a URL.

Common situations: Hand-edited portals.yml missing https://; placeholder text never replaced; trailing whitespace or newline pasted into the config value; yml quoting issues that mangle the value.

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/f0adf71a3dca7ecf. Report an issue: GitHub.

Appendix: 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 aac998c7ed)