santifer/career-ops · error · Error
weworkremotely: invalid URL
Error message
weworkremotely: invalid URL: ${url} What it means
The weworkremotely provider validates URLs through assertWwrUrl before use. If the string cannot be parsed by the WHATWG URL constructor at all (missing scheme, spaces, malformed percent-encoding, empty string), it throws this error. This is the first gate — before the HTTPS and hostname checks — so it fires on structurally broken input, not just wrong hosts.
Solutions
- Add the missing scheme: prefix the value with https:// (e.g. https://weworkremotely.com/remote-jobs.rss)
- Trim whitespace/newlines from the configured value and check for invisible characters
- Verify with a quick sanity check: new URL(url) in a Node REPL should not throw
- If the value is interpolated, log the exact final string before the call to see what actually got built
Example fix
// before careers_url: weworkremotely.com/remote-jobs.rss // after careers_url: https://weworkremotely.com/remote-jobs.rss
Defensive patterns
Strategy: validation
Validate before calling
function isParsableUrl(url) {
try { new URL(url); return true; } catch { return false; }
}
// pre-check: isParsableUrl(entry.careers_url) else fix the string Type guard
const isUrl = (v) => typeof v === 'string' && (() => { try { new URL(v); return true; } catch { return false; } })(); Try / catch
try {
await wwrProvider.fetch(entry, ctx);
} catch (err) {
if (err.message.startsWith('weworkremotely: invalid URL')) {
console.error(`Bad URL for ${entry.name}: ${err.message} — add https:// and trim whitespace`);
return;
}
throw err;
} Prevention
- Always include the scheme when storing URLs in config
- Trim and normalize URL strings (strip whitespace/newlines) when loading config
- Log the final interpolated URL string before provider calls during config debugging
- Avoid building URLs by concatenation; prefer URL objects or template constants
When it happens
Trigger: Passing a value like 'weworkremotely.com/remote-jobs.rss' (no scheme), an empty string, a URL with unencoded spaces or control characters, or a non-string value coerced to something unparseable into any code path that calls assertWwrUrl (e.g. a careers_url or feed URL from portals.yml).
Common situations: Config entries missing the https:// prefix, URLs pasted with surrounding whitespace/newlines that survived a trim, shell or template interpolation that produced 'https://undefined/...' or similar, URLs built by naive string concatenation.
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
- workable: invalid URL
- comeet: URL path must be the careers-api endpoint
- consider: needs an https careers_url on a public host
- ⚠️ Could not parse config/profile.yml
- csod: cannot resolve careersite URL for
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/2eeb4e74ea310260.
Report an issue: GitHub.
Appendix: source
Thrown at providers/weworkremotely.mjs:21
/** @typedef {import('./_types.js').Provider} Provider */
// We Work Remotely provider - board-wide RSS feed
// (https://weworkremotely.com/remote-jobs.rss). The feed is public, no-auth,
// and XML, so it is parsed in-process with the same tiny tag extractor approach
// as providers/personio.mjs rather than adding an XML dependency.
//
// Wire in via a `job_boards:` entry with `provider: weworkremotely`.
const FEED_URL = 'https://weworkremotely.com/remote-jobs.rss';
const TRUSTED_HOST = 'weworkremotely.com';
/** @param {string} url */
function assertWwrUrl(url) {
let parsed;
try {
parsed = new URL(url);
} catch {
throw new Error(`weworkremotely: invalid URL: ${url}`);
}
if (parsed.protocol !== 'https:') throw new Error(`weworkremotely: URL must use HTTPS: ${url}`);
if (parsed.hostname !== TRUSTED_HOST) {
throw new Error(`weworkremotely: 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() : 'We Work Remotely';
}View on GitHub (pinned to aac998c7ed)