santifer/career-ops · error · Error
torre: invalid URL
Error message
torre: invalid URL: ${url} What it means
assertTorreUrl() is the torre provider's URL validator, mirroring themuse's: it parses the input with the URL constructor, and a string that cannot be parsed throws this error before the HTTPS and trusted-host checks run. It guarantees every URL the provider handles is at least syntactically a URL.
Solutions
- Fix the URL in the config to a complete, absolute URL (the offending string is printed in the error).
- Trim whitespace and normalize quotes; verify no undefined variable was interpolated into the URL.
- Sanity-check with new URL(value) in a Node REPL — it throws with the precise syntax complaint.
- Then confirm the next checks will pass: https scheme and the trusted Torre API hostname.
Example fix
// before url: torre.ai/api/jobs // after url: https://torre.ai/api/jobs
Defensive patterns
Strategy: validation
Validate before calling
function isParseableTorreUrl(value) {
if (typeof value !== 'string' || value.trim() === '') return false;
try { new URL(value.trim()); return true; } catch { return false; }
}
// validate config first: entries.filter(e => !isParseableTorreUrl(e.url)) → fix before running Type guard
const isUrl = (v) =>
typeof v === 'string'
&& v.length > 0
&& (() => { try { new URL(v); return true; } catch { return false; } })(); Try / catch
try {
return await provider.fetch(entry, ctx);
} catch (err) {
if (String(err.message).startsWith('torre: invalid URL')) {
console.error(`Fix URL for ${entry.name}: ${err.message}`);
return null;
}
throw err;
} Prevention
- Store complete absolute URLs (scheme included) in portals.yml
- Run new URL() over every configured URL in a pre-commit validation script
- Guard template-built URLs: assert the interpolated variables are defined and scheme-prefixed
- Strip whitespace and smart quotes when pasting URLs from docs, chat, or browsers
When it happens
Trigger: assertTorreUrl(url) receives input that new URL() rejects — no scheme ('torre.co/jobs'), embedded spaces or invalid characters, empty string, or a truncated interpolated URL.
Common situations: A portals.yml entry missing the https:// prefix; whitespace or smart quotes introduced by copy-paste; a template string whose variable was undefined, yielding 'https://undefined/...' or a bare fragment.
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
- arbeitnow: invalid URL
- ashby: invalid URL
- bamboohr: invalid URL
- breezy: invalid URL
- builtin: invalid URL
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/7ed4798d17b679ff.
Report an issue: GitHub.
Appendix: source
Thrown at providers/torre.mjs:90
// Values the API accepts for the required `skill/role.experience` companion,
// confirmed live; anything else is rejected server-side. Every one returns the
// same result set, so the default is arbitrary among them.
const EXPERIENCE_LEVELS = new Set([
'potential-to-develop',
'1-plus-year',
'2-plus-years',
'3-plus-years',
'5-plus-years',
]);
const DEFAULT_EXPERIENCE = '1-plus-year';
/** @param {string} url */
function assertTorreUrl(url) {
let parsed;
try {
parsed = new URL(url);
} catch {
throw new Error(`torre: invalid URL: ${url}`);
}
if (parsed.protocol !== 'https:') throw new Error(`torre: URL must use HTTPS: ${url}`);
if (parsed.hostname !== TRUSTED_API_HOST) {
throw new Error(`torre: untrusted hostname "${parsed.hostname}" — must be ${TRUSTED_API_HOST}`);
}
return url;
}
/**
* Build the search body from the portal entry. Only filters proven to affect
* `total` are emitted — see the header note. Exported for tests.
*
* @param {any} entry
* @returns {object}
*/
export function buildTorreQuery(entry) {
/** @type {Record<string, unknown>} */
const body = {};View on GitHub (pinned to aac998c7ed)