santifer/career-ops · error · Error
themuse: invalid URL: ${url}
Error message
themuse: invalid URL: ${url} What it means
assertMuseUrl wraps new URL in try/catch and throws 'themuse: invalid URL' on a parse failure. In the shipped provider this guard is only ever called with the hardcoded constant FEED_BASE ('https://www.themuse.com/api/public/jobs'), so the error is effectively unreachable unless FEED_BASE is changed or the function is called with external input.
Source
Thrown at providers/themuse.mjs:20
/** @typedef {import('./_types.js').Provider} Provider */
// The Muse provider — public, zero-auth JSON jobs feed.
// Endpoint: https://www.themuse.com/api/public/jobs?page={n}
// Response shape: { results: [...], page: n, page_count: N }
// All pages are fetched sequentially and aggregated before normalizing.
//
// Wire in via a `job_boards:` entry with `provider: themuse`.
const FEED_BASE = 'https://www.themuse.com/api/public/jobs';
const TRUSTED_HOST = 'www.themuse.com';
/** @param {string} url */
function assertMuseUrl(url) {
let parsed;
try {
parsed = new URL(url);
} catch {
throw new Error(`themuse: invalid URL: ${url}`);
}
if (parsed.protocol !== 'https:') throw new Error(`themuse: URL must use HTTPS: ${url}`);
if (parsed.hostname !== TRUSTED_HOST) {
throw new Error(`themuse: untrusted hostname "${parsed.hostname}" — must be ${TRUSTED_HOST}`);
}
return url;
}
/**
* Normalize a single result from the Muse API response. Exported for unit tests.
*
* Field mapping:
* name → title
* refs.landing_page → url
* company.name → company
* locations[0].name → location
*
* Returns null when required fields (title or url) are missing or invalid.View on GitHub (pinned to 9b17a8ac97)
Solutions
- Restore FEED_BASE to 'https://www.themuse.com/api/public/jobs'
- If you intentionally retarget the feed, supply a valid absolute URL
- Do not call assertMuseUrl with user/config URLs — it validates the internal feed constant only
Defensive patterns
Strategy: validation
Validate before calling
// assertMuseUrl validates a constant; lint that FEED_BASE is a valid URL at startup.
try { new URL(FEED_BASE); } catch { throw new Error('themuse: FEED_BASE is not a valid URL'); } Prevention
- Do not edit FEED_BASE without re-validating it parses.
- Do not call assertMuseUrl with external URLs.
When it happens
Trigger: FEED_BASE was edited to a malformed value, or assertMuseUrl is invoked from a test/fork with a non-URL string. The provider takes no URL from config (fetch ignores _entry), so config cannot trigger it.
Common situations: A fork changes FEED_BASE without quoting/validating; a unit test passes bad input to the exported guard.
Related errors
- themuse: URL must use HTTPS: ${url}
- themuse: untrusted hostname "${parsed.hostname}" — must be $
- smartrecruiters: untrusted hostname "${parsed.hostname}" — m
- flowxtra: untrusted hostname "${parsed.hostname}" — must be
- gem: invalid URL: ${url}
AI-assisted analysis of santifer/career-ops@9b17a8ac97 (2026-08-13).
Data as JSON: /api/errors/07c2b10ad85e51b0.
Report an issue: GitHub.