{"record":{"id":"521492b53f9788db","repo":"santifer/career-ops","slug":"nodesk-invalid-url-url","errorCode":null,"errorMessage":"nodesk: invalid URL: ${url}","messagePattern":"nodesk: invalid URL: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/nodesk.mjs","lineNumber":21,"sourceCode":"/** @typedef {import('./_types.js').Provider} Provider */\n\n// NoDesk provider - board-wide RSS feed\n// (https://nodesk.co/remote-jobs/index.xml). The feed is public, no-auth,\n// and XML, so it is parsed in-process with the same tiny tag extractor\n// approach as providers/personio.mjs rather than adding an XML dependency.\n//\n// Wire in via a `job_boards:` entry with `provider: nodesk`.\n\nconst FEED_URL = 'https://nodesk.co/remote-jobs/index.xml';\nconst TRUSTED_HOST = 'nodesk.co';\n\n/** @param {string} url */\nfunction assertNodeskUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`nodesk: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`nodesk: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_HOST) {\n    throw new Error(`nodesk: untrusted hostname \"${parsed.hostname}\" - must be ${TRUSTED_HOST}`);\n  }\n  return url;\n}\n\n// NaN-safe Date.parse - `|| undefined` would also coerce a valid epoch 0.\nfunction toEpochMs(value) {\n  if (!value) return undefined;\n  const parsed = Date.parse(value);\n  return Number.isNaN(parsed) ? undefined : parsed;\n}\n\nfunction fallbackCompany(entry) {\n  return typeof entry?.name === 'string' && entry.name.trim() ? entry.name.trim() : 'NoDesk';\n}","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/nodesk.mjs#L3-L39","documentation":"The nodesk provider validates every URL it is given before use. This error is thrown by assertNodeskUrl when the input string cannot be parsed as a URL at all — i.e. new URL(url) throws (missing scheme, whitespace, malformed syntax). It fails fast so a bad config value never reaches the network layer.","triggerScenarios":"Calling assertNodeskUrl (directly or via the nodesk provider's detect/fetch path) with a string that fails the URL constructor: an empty string, 'nodesk.com/jobs' without a scheme, 'https:/wrong', or a value containing spaces or control characters.","commonSituations":"A careers_url in portals.yml missing the 'https://' prefix; an env-var or CLI argument that is empty because it was never set; hand-edited config introducing a stray character or truncating the URL; template placeholders left unfilled ('${URL}').","solutions":["Fix the URL string in the config/source so it is a complete absolute URL starting with https://","Trim whitespace and remove newlines/comments accidentally included in the config value","Check for unset variables/empty strings being passed in; add a default or an early check","If the entry should not point at nodesk at all, remove it from the provider's input instead of forcing it through"],"exampleFix":"// before\nassertNodeskUrl(process.env.NODESK_URL);\n// after\nconst raw = (process.env.NODESK_URL || '').trim();\nif (!raw) throw new Error('NODESK_URL is not set');\nassertNodeskUrl(raw.startsWith('http') ? raw : `https://${raw}`);","handlingStrategy":"validation","validationCode":"function isParsableUrl(u) { try { new URL(u); return true; } catch { return false; } }\nif (!isParsableUrl(url)) throw new Error(`skipping entry: not a URL: ${url}`);","typeGuard":"function isAbsoluteUrl(u) {\n  if (typeof u !== 'string' || u.length === 0) return false;\n  try { const p = new URL(u); return !!p.protocol && !!p.hostname; } catch { return false; }\n}","tryCatchPattern":"try {\n  useNodesk(url);\n} catch (e) {\n  if (String(e.message).startsWith('nodesk: invalid URL')) {\n    log.warn(`Skipping bad URL: ${url}`);\n    return null;\n  }\n  throw e;\n}","preventionTips":["Validate all URLs at config-load time, before any provider runs","Always store full absolute URLs with explicit https:// scheme in config files","Trim string values read from env vars and CLI args before use","Write a startup lint that reports every unparseable careers_url entry instead of failing mid-run"],"tags":["url-validation","config","input-validation"],"backgroundTag":"invalid-url-format","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"}