santifer/career-ops · error · Error

Invalid or blocked URL after redirect

Error message

Invalid or blocked URL after redirect: ${finalRejected.reason}

What it means

Post-navigation SSRF re-check in scrapeUrl: after page.goto, the browser's final URL (i.e. where redirects actually landed) was run through rejectPrivateOrInvalid() and failed. The initial URL passed, but the site redirected to a private/loopback address or a blocked scheme. The interpolated reason names the failing check; the input at fault is the redirect target of the original URL.

Solutions

  1. Open the URL in a browser and identify where it redirects; if the final target is internal, remove the entry
  2. Use the final public redirect target directly in the batch input
  3. If the redirect is conditional (geo/UA-based), try fetching the canonical posting URL from the ATS API instead
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at batch-evaluate-gemini.mjs:213 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at batch-evaluate-gemini.mjs:213

    throw new Error(`Invalid or blocked URL: ${rejected.reason}`);
  }
  
  const page = await browser.newPage();
  try {
    await page.route('**/*', (route) => {
      const targetUrl = route.request().url();
      const interceptedRejected = rejectPrivateOrInvalid(targetUrl);
      if (interceptedRejected) {
        return route.abort('accessdenied');
      }
      return route.continue();
    });

    await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
    
    const finalRejected = rejectPrivateOrInvalid(page.url());
    if (finalRejected) {
      throw new Error(`Invalid or blocked URL after redirect: ${finalRejected.reason}`);
    }

    await page.waitForTimeout(2000); // wait for dynamic content
    const text = await page.evaluate(() => {
      document.querySelectorAll('script, style, noscript, iframe, svg, img').forEach(s => s.remove());
      return document.body.innerText;
    });
    return text.trim();
  } finally {
    await page.close();
  }
}

async function evaluateWithRetry(jdText, retries = 5) {
  if (typeof retries !== 'number' || isNaN(retries) || retries < 1) retries = 1;
  let attempt = 0;
  let delay = 5000;
  while (attempt < retries) {

View on GitHub (pinned to aac998c7ed)