santifer/career-ops · error · Error
larajobs: invalid URL: ${url}
Error message
larajobs: invalid URL: ${url} What it means
assertLarajobsUrl runs the value through the WHATWG URL constructor; if construction throws (the string is not an absolute, parseable URL), this error is raised. It is the first of three sequential guards (parse → HTTPS → trusted host) protecting the feed fetch from malformed or malicious URLs.
Source
Thrown at providers/larajobs.mjs:24
// and XML, so it is parsed in-process with the same tiny tag extractor as
// providers/nodesk.mjs rather than adding an XML dependency.
//
// Each <item> carries the standard RSS fields plus a `job:` namespace with
// `<job:company>` and `<job:location>`, so company and location come straight
// from the feed (no title-splitting heuristics needed).
//
// Wire in via a `job_boards:` entry with `provider: larajobs`.
const FEED_URL = 'https://larajobs.com/feed';
const TRUSTED_HOST = 'larajobs.com';
/** @param {string} url */
function assertLarajobsUrl(url) {
let parsed;
try {
parsed = new URL(url);
} catch {
throw new Error(`larajobs: invalid URL: ${url}`);
}
if (parsed.protocol !== 'https:') throw new Error(`larajobs: URL must use HTTPS: ${url}`);
if (parsed.hostname !== TRUSTED_HOST) {
throw new Error(`larajobs: untrusted hostname "${parsed.hostname}" - must be ${TRUSTED_HOST}`);
}
return url;
}
// NaN-safe Date.parse - `|| undefined` would also coerce a valid epoch 0.
function toEpochMs(value) {
if (!value) return undefined;
const parsed = Date.parse(value);
return Number.isNaN(parsed) ? undefined : parsed;
}
function fallbackCompany(entry) {
return typeof entry?.name === 'string' && entry.name.trim() ? entry.name.trim() : 'LaraJobs';
}View on GitHub (pinned to 9b17a8ac97)
Solutions
- Inspect the value printed in the message — it is the exact string that failed to parse.
- Ensure the URL has an explicit scheme, e.g. https://larajobs.com/feed.
- Trim whitespace in the config source (portals.yml) and re-run.
- If the URL is user-supplied, validate with new URL(...) in your own config loader before it reaches the provider.
Example fix
// before (config) api: larajobs.com/feed // after api: https://larajobs.com/feed
Defensive patterns
Strategy: validation
Validate before calling
// Validate entry URLs in your config loader BEFORE the provider sees them.
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; }
}
// if (!isValidAbsoluteUrl(entry.api)) failConfig('larajobs api is not a valid URL'); Type guard
/** @param {string} url */
function isParseableUrl(url) {
try { new URL(url); return true; } catch { return false; }
} Try / catch
// detect() already swallows this; for direct calls, catch and degrade gracefully.
try {
assertLarajobsUrl(candidate);
} catch (err) {
// mark the entry as misconfigured and exclude from the run
entry.disabled = true;
console.warn(`disabling ${entry.name}: ${err.message}`);
} Prevention
- Run a config pre-flight pass over portals.yml that asserts every api:/careers_url parses as a URL.
- Always include the https:// scheme in config URLs — never bare hostnames.
- Treat an empty api: field as a config error at load time, not at fetch time.
- Use a linter/schema validator for portals.yml to catch malformed URLs before runtime.
When it happens
Trigger: entry.api or a constructed URL passed to assertLarajobsUrl is an empty string, a relative path like '/feed', a string with embedded spaces/control chars, a missing-scheme string like 'larajobs.com/feed', or any value the URL constructor rejects.
Common situations: portals.yml has a typo in an api: field (missing https://), a templated URL was left blank, or the FEED_URL constant was edited to a relative path. Also fires if a stray whitespace/newline was copied into the config.
Related errors
- flowxtra: untrusted hostname "${parsed.hostname}" — must be
- gem: invalid URL: ${url}
- gem: URL must use HTTPS: ${url}
- gem: untrusted hostname "${parsed.hostname}" — must be one o
- getonbrd: invalid URL: ${url}
AI-assisted analysis of santifer/career-ops@9b17a8ac97 (2026-08-13).
Data as JSON: /api/errors/3b8569c5d792fdf6.
Report an issue: GitHub.