santifer/career-ops · error · Error
yourator: invalid URL
Error message
yourator: invalid URL: ${url} What it means
assertYouratorUrl parses a URL with new URL() before the yourator provider fetches it, throwing this error when parsing fails entirely. new URL throws on strings that are not absolute URLs — missing scheme, whitespace, malformed characters, or a relative path. This is the first of three guards (parse, HTTPS, host) ensuring the provider only ever fetches a well-formed address.
Solutions
- Prefix the value with https:// if the scheme is missing (e.g. 'yourator.net/en/companies/x' → 'https://yourator.net/...')
- Trim whitespace and strip stray quotes/backticks from the configured URL
- Encode illegal characters (spaces) or remove them from path segments
- Validate the string with new URL() in the config layer before handing it to the provider
Example fix
// before
const url = cfg.companyUrl; // "yourator.net/companies/acme"
assertYouratorUrl(url);
// after
const raw = String(cfg.companyUrl).trim();
const url = raw.startsWith('http') ? raw : `https://${raw}`;
assertYouratorUrl(url); Defensive patterns
Strategy: validation
Validate before calling
// validate before calling the provider
function buildYouratorUrl(input) {
const raw = String(input ?? '').trim().replace(/^["']|["']$/g, '');
const url = /^https?:\/\//i.test(raw) ? raw : `https://${raw}`;
new URL(url); // throws early with a clear message if still malformed
return url;
} Type guard
function isParsableUrl(s) {
try { new URL(s); return true; } catch { return false; }
} Try / catch
try {
await scanYourator(entry);
} catch (e) {
if (e.message.startsWith('yourator: invalid URL')) {
console.warn(`Fix the configured URL (add scheme, encode spaces): ${e.message}`);
} else throw e;
} Prevention
- Store Yourator URLs in portals.yml as full absolute https:// URLs
- Trim and strip quotes from config strings before URL construction
- Avoid hand-building URLs by concatenation; use URL/URLSearchParams
- Encode or reject path segments containing spaces or illegal characters
When it happens
Trigger: Passing a relative path like '/companies/foo', a URL with unencoded spaces or invalid characters, an empty or non-string value coerced to something unparsable, or a typo like 'yourator.com/x' without the scheme.
Common situations: Config values copied from a browser address bar after the scheme was stripped; YAML values that lose the 'https://' prefix; template placeholders left in place; user input fed directly without validation.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- yourator: URL must use HTTPS
- 4dayweek: invalid URL
- 4dayweek: URL must use HTTPS
- arbeitnow: invalid URL
- arbeitnow: URL must use HTTPS
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/0ba1779792a4f849.
Report an issue: GitHub.
Appendix: source
Thrown at providers/yourator.mjs:81
// Per the Job contract, postedAt is omitted rather than guessed — a synthesized
// date would silently corrupt scan-ats-full.mjs's recency filtering.
const SITE_ORIGIN = 'https://www.yourator.co';
const FEED_BASE = `${SITE_ORIGIN}/api/v4/jobs`;
const TRUSTED_HOST = 'www.yourator.co';
// Safety bound only — the loop stops on payload.hasMore. The live board was 88
// pages on 2026-08-18; this leaves room to grow without silently truncating.
const DEFAULT_MAX_PAGES = 120;
const MAX_PAGES_CAP = 500;
const PAGE_DELAY_MS = 200;
/** @param {string} url */
function assertYouratorUrl(url) {
let parsed;
try {
parsed = new URL(url);
} catch {
throw new Error(`yourator: invalid URL: ${url}`);
}
if (parsed.protocol !== 'https:') throw new Error(`yourator: URL must use HTTPS: ${url}`);
if (parsed.hostname !== TRUSTED_HOST) {
throw new Error(`yourator: untrusted hostname "${parsed.hostname}" — must be ${TRUSTED_HOST}`);
}
return url;
}
/** Resolve the page cap: a positive integer `max_pages` on the entry, capped. */
function resolveMaxPages(entry) {
const v = entry?.max_pages;
if (Number.isInteger(v) && v > 0) return Math.min(v, MAX_PAGES_CAP);
return DEFAULT_MAX_PAGES;
}
/**
* Canonical URL for a posting — Source Indexing Policy rule 2, "the shortest
* verifiable path to the employer the source exposes".View on GitHub (pinned to aac998c7ed)