{"record":{"id":"656bdbf9490822ec","repo":"santifer/career-ops","slug":"invalid-or-blocked-url-after-redirect-finalreje","errorCode":null,"errorMessage":"Invalid or blocked URL after redirect: ${finalRejected.reason}","messagePattern":"Invalid or blocked URL after redirect: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"batch-evaluate-gemini.mjs","lineNumber":213,"sourceCode":"    throw new Error(`Invalid or blocked URL: ${rejected.reason}`);\n  }\n  \n  const page = await browser.newPage();\n  try {\n    await page.route('**/*', (route) => {\n      const targetUrl = route.request().url();\n      const interceptedRejected = rejectPrivateOrInvalid(targetUrl);\n      if (interceptedRejected) {\n        return route.abort('accessdenied');\n      }\n      return route.continue();\n    });\n\n    await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });\n    \n    const finalRejected = rejectPrivateOrInvalid(page.url());\n    if (finalRejected) {\n      throw new Error(`Invalid or blocked URL after redirect: ${finalRejected.reason}`);\n    }\n\n    await page.waitForTimeout(2000); // wait for dynamic content\n    const text = await page.evaluate(() => {\n      document.querySelectorAll('script, style, noscript, iframe, svg, img').forEach(s => s.remove());\n      return document.body.innerText;\n    });\n    return text.trim();\n  } finally {\n    await page.close();\n  }\n}\n\nasync function evaluateWithRetry(jdText, retries = 5) {\n  if (typeof retries !== 'number' || isNaN(retries) || retries < 1) retries = 1;\n  let attempt = 0;\n  let delay = 5000;\n  while (attempt < retries) {","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/batch-evaluate-gemini.mjs#L195-L231","documentation":"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.","triggerScenarios":"Thrown at batch-evaluate-gemini.mjs:213 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Open the URL in a browser and identify where it redirects; if the final target is internal, remove the entry","Use the final public redirect target directly in the batch input","If the redirect is conditional (geo/UA-based), try fetching the canonical posting URL from the ATS API instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}