{"record":{"id":"876619ea113c64f8","repo":"santifer/career-ops","slug":"agentic-jobs-invalid-url-url","errorCode":null,"errorMessage":"agentic-jobs: invalid URL: ${url}","messagePattern":"agentic-jobs: invalid URL: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/agentic-jobs.mjs","lineNumber":45,"sourceCode":"// boards; MAX_PAGES is a hard stop regardless.\n//\n// Wire in via a `job_boards:` entry with `provider: agentic-jobs`.\n\nconst SITE_ORIGIN = 'https://agentic-engineering-jobs.com';\nconst API_BASE = `${SITE_ORIGIN}/api/v1`;\nconst TRUSTED_HOST = 'agentic-engineering-jobs.com';\nconst PAGE_SIZE = 50; // fixed by the API (meta.per_page)\nconst MAX_PAGES = 40; // safety cap on request count (40*50 = 2000 postings)\nconst MAX_JOBS = 2000;\nconst PAGE_DELAY_MS = 2100; // stays under the documented 30 req/60s limit\n\n/** @param {string} url */\nfunction assertAgenticUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`agentic-jobs: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`agentic-jobs: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_HOST) {\n    throw new Error(`agentic-jobs: untrusted hostname \"${parsed.hostname}\" — must be ${TRUSTED_HOST}`);\n  }\n  return url;\n}\n\nconst regionNames = new Intl.DisplayNames(['en'], { type: 'region' });\n\n/**\n * Resolve a two-letter ISO country code to an English name. Returns '' for\n * anything that isn't a resolvable two-letter code. Exported for tests.\n * @param {unknown} code\n */\nexport function countryName(code) {\n  if (typeof code !== 'string' || !/^[A-Za-z]{2}$/.test(code)) return '';\n  try {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/providers/agentic-jobs.mjs#L27-L63","documentation":"The agentic-jobs provider (agentic-engineering-jobs.com) validates its API URL via assertAgenticUrl(). This first guard throws if `new URL(url)` fails — a malformed/empty/no-protocol string. It precedes the protocol and hostname checks.","triggerScenarios":"API_BASE (the compiled-in base) or a supplied URL fails URL parsing: empty string, 'agentic-engineering-jobs.com/api' without a scheme, undefined, or control characters. API_BASE is a trusted constant, so this typically means a bad edit to that constant.","commonSituations":"API_BASE edited to drop the https:// scheme; partial URL pasted.","solutions":["Inspect API_BASE at the top of providers/agentic-jobs.mjs — it must be a complete absolute URL (e.g. 'https://agentic-engineering-jobs.com/api').","Ensure any entry URL override is a valid absolute https URL."],"exampleFix":"// before\nconst API_BASE = 'agentic-engineering-jobs.com/api';\n\n// after\nconst API_BASE = 'https://agentic-engineering-jobs.com/api';","handlingStrategy":"validation","validationCode":"function assertValidUrl(url) {\n  try { new URL(url); return true; } catch { return false; }\n}\nif (!assertValidUrl(API_BASE)) throw new Error('agentic-jobs API_BASE is not a valid URL');","typeGuard":"/** @param {unknown} u @returns {u is string} */\nfunction isValidUrlString(u) {\n  if (typeof u !== 'string' || u.length === 0) return false;\n  try { new URL(u); return true; } catch { return false; }\n}","tryCatchPattern":"try { assertAgenticUrl(url); } catch (err) {\n  if (/invalid URL/.test(err.message)) console.error('agentic-jobs API_BASE malformed — fix it.');\n  throw err;\n}","preventionTips":["Validate API_BASE at startup; unit-test it passes assertAgenticUrl on every build.","Keep API_BASE/TRUSTED_HOST in config."],"tags":["agentic-jobs","url","validation","provider","ssrf-guard"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}