{"record":{"id":"7ed4798d17b679ff","repo":"santifer/career-ops","slug":"torre-invalid-url-url","errorCode":null,"errorMessage":"torre: invalid URL: ${url}","messagePattern":"torre: invalid URL: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/torre.mjs","lineNumber":90,"sourceCode":"// Values the API accepts for the required `skill/role.experience` companion,\n// confirmed live; anything else is rejected server-side. Every one returns the\n// same result set, so the default is arbitrary among them.\nconst EXPERIENCE_LEVELS = new Set([\n  'potential-to-develop',\n  '1-plus-year',\n  '2-plus-years',\n  '3-plus-years',\n  '5-plus-years',\n]);\nconst DEFAULT_EXPERIENCE = '1-plus-year';\n\n/** @param {string} url */\nfunction assertTorreUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`torre: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`torre: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_API_HOST) {\n    throw new Error(`torre: untrusted hostname \"${parsed.hostname}\" — must be ${TRUSTED_API_HOST}`);\n  }\n  return url;\n}\n\n/**\n * Build the search body from the portal entry. Only filters proven to affect\n * `total` are emitted — see the header note. Exported for tests.\n *\n * @param {any} entry\n * @returns {object}\n */\nexport function buildTorreQuery(entry) {\n  /** @type {Record<string, unknown>} */\n  const body = {};","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/torre.mjs#L72-L108","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nurl: torre.ai/api/jobs\n// after\nurl: https://torre.ai/api/jobs","handlingStrategy":"validation","validationCode":"function isParseableTorreUrl(value) {\n  if (typeof value !== 'string' || value.trim() === '') return false;\n  try { new URL(value.trim()); return true; } catch { return false; }\n}\n// validate config first: entries.filter(e => !isParseableTorreUrl(e.url)) → fix before running","typeGuard":"const isUrl = (v) =>\n  typeof v === 'string'\n  && v.length > 0\n  && (() => { try { new URL(v); return true; } catch { return false; } })();","tryCatchPattern":"try {\n  return await provider.fetch(entry, ctx);\n} catch (err) {\n  if (String(err.message).startsWith('torre: invalid URL')) {\n    console.error(`Fix URL for ${entry.name}: ${err.message}`);\n    return null;\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["url","validation","torre","config"],"backgroundTag":"invalid-url","analyzedSha":"aac998c7ed7248ea853b720ceeb1fdbeb322fc5d","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}