santifer/career-ops · error · Error

senjob: invalid URL

Error message

senjob: invalid URL: ${url}

What it means

The senjob provider validates URLs via assertSenjobUrl. If the URL string cannot be parsed by the URL constructor, it throws this error before any request is made. This keeps malformed targets from reaching the fetch layer.

Solutions

  1. Make the URL absolute and well-formed (e.g. https://www.senjob.de/...).
  2. Log the exact value at the call site and fix the producer of the malformed string.
  3. Prepend the scheme when absent before calling the provider.

Example fix

// before
const url = 'senjob.de/jobs';
// after
const url = 'https://www.senjob.de/jobs';
Defensive patterns

Strategy: validation

Validate before calling

const isParseable = (u) => { try { new URL(u); return true; } catch { return false; } };
if (!isParseable(entry.url)) console.warn(`senjob entry URL malformed: ${entry.url}`);

Type guard

const isUrl = (u) => { try { new URL(u); return true; } catch { return false; } };

Try / catch

try { await provider.fetch(entry, ctx); } catch (e) { if (e.message.startsWith('senjob: invalid URL')) { console.error(`Malformed senjob URL: ${entry.url}`); return null; } throw e; }

Prevention

When it happens

Trigger: Passing a string that fails new URL() to the senjob provider — missing scheme ('senjob.de/...'), whitespace/control characters, or an undefined/empty value where a URL is expected.

Common situations: Config entries missing the https:// prefix, URL assembly from parts where a segment was empty, or truncated values from env/config parsing.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/2f4fe4d45b4f3e58. Report an issue: GitHub.

Appendix: source

Thrown at providers/senjob.mjs:77

const POSTING_ANCHOR_RE =
  /<a\s[^>]*href="https:\/\/senjob\.com\/jobseekers\/[^"]*?_e_\d+\.html"[^>]*>([\s\S]*?)<\/a>/i;

/** The machine-readable publication date, hidden next to its localized form. */
const HIDDEN_ISO_DATE_RE = /display:\s*none;?\s*"?>\s*(\d{4}-\d{2}-\d{2})\s*</i;

/** @param {any} ctx @param {number} ms */
function sleep(ctx, ms) {
  if (typeof ctx?.sleep === 'function') return ctx.sleep(ms);
  return new Promise((r) => setTimeout(r, ms));
}

/** @param {string} url */
function assertSenjobUrl(url) {
  let parsed;
  try {
    parsed = new URL(url);
  } catch {
    throw new Error(`senjob: invalid URL: ${url}`);
  }
  if (parsed.protocol !== 'https:') throw new Error(`senjob: URL must use HTTPS: ${url}`);
  if (parsed.hostname !== TRUSTED_HOST) {
    throw new Error(`senjob: untrusted hostname "${parsed.hostname}" — must be ${TRUSTED_HOST}`);
  }
  return url;
}

/**
 * Collapse a markup fragment to its visible text.
 * Comments are stripped FIRST: the anchor bodies carry `<!-- d ico postulez -->`
 * between the title and a spacer image, and a naive tag strip would leave the
 * comment body sitting inside the title.
 * @param {string} fragment
 * @returns {string}
 */
export function visibleText(fragment) {
  return decodeEntities(

View on GitHub (pinned to aac998c7ed)