{"record":{"id":"44ec7bf0495423e0","repo":"santifer/career-ops","slug":"getro-label-could-not-resolve-collection-id","errorCode":null,"errorMessage":"getro: ${label} — could not resolve collection_id from ${careersUrl.href} (no network.id found in __NEXT_DATA__; page structure may have changed — set getro_collection: N on this entry as a fallback)","messagePattern":"getro: (.+?) — could not resolve collection_id from (.+?) \\(no network\\.id found in __NEXT_DATA__; page structure may have changed — set getro_collection: N on this entry as a fallback\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"providers/getro.mjs","lineNumber":157,"sourceCode":"  return null;\n}\n\n/** Override wins; otherwise fetch careers_url and parse __NEXT_DATA__. */\nasync function resolveCollectionId(entry, ctx, careersUrl) {\n  const override = resolveCollectionOverride(entry);\n  if (override) return override;\n\n  const label = entry?.name || careersUrl.href;\n  // Retried like every page fetch below — this single request runs BEFORE\n  // pagination even starts, so without a retry a transient blip here (DNS/TLS/\n  // connection reset) fails the whole board before a single page is fetched.\n  const html = await fetchTextWithRetry(ctx, careersUrl.href, {\n    redirect: 'error',\n    headers: { accept: 'text/html', 'user-agent': BROWSER_LIKE_USER_AGENT },\n  });\n  const id = extractCollectionId(html);\n  if (!id) {\n    throw new Error(\n      `getro: ${label} — could not resolve collection_id from ${careersUrl.href} (no network.id found in ` +\n      `__NEXT_DATA__; page structure may have changed — set getro_collection: N on this entry as a fallback)`,\n    );\n  }\n  return id;\n}\n\n/**\n * `{min, max, currency}` shape scan.mjs's salary_filter consumes, or null\n * when there's no usable figure. A non-year compensation_period\n * (hourly/monthly/etc.) is treated as \"no usable annual figure\".\n */\nfunction getroSalary(job) {\n  const period = typeof job?.compensation_period === 'string' ? job.compensation_period.trim().toLowerCase() : '';\n  if (period && period !== 'year') return null;\n  const minCents = Number(job?.compensation_amount_min_cents);\n  const maxCents = Number(job?.compensation_amount_max_cents);\n  const min = Number.isFinite(minCents) && minCents > 0 ? minCents / 100 : null;","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/getro.mjs#L139-L175","documentation":"resolveCollectionId scrapes a Getro-powered careers page for a network.id inside its __NEXT_DATA__ JSON to derive the Getro API collection_id. If fetchTextWithRetry returns HTML but extractCollectionId cannot find a network.id, the function throws this error suggesting the page structure changed and pointing at the getro_collection config override as a fallback.","triggerScenarios":"A Getro careers page renders without __NEXT_DATA__ (SSR change, bot-wall/challenge page, interstitial, or a soft error page), so extractCollectionId finds no network.id in the fetched HTML for the entry's careers_url.","commonSituations":"Getro updates its Next.js page structure or stops inlining network.id; the site serves a Cloudflare/bot challenge to the scanner's user-agent; the careers URL redirects to a generic marketing page; the company migrated off Getro.","solutions":["Set getro_collection: <N> on the portal entry with the collection id — the documented fallback that bypasses scraping entirely (find N in the page source via browser devtools: look for network.id in __NEXT_DATA__, or inspect the XHR to getro.app/.../search/jobs)","Open the careers_url in a browser and confirm it still resolves to a Getro-powered board; update careers_url if the company moved","Check whether a bot challenge is being served to BROWSER_LIKE_USER_AGENT — retrying later or from another network can help","Verify the company still uses Getro; if they migrated ATS platforms, change the entry's provider"],"exampleFix":"# before (portals.yml entry)\n- name: Acme\n  provider: getro\n  careers_url: https://careers.acme.com\n# after\n- name: Acme\n  provider: getro\n  careers_url: https://careers.acme.com\n  getro_collection: 12345","handlingStrategy":"fallback","validationCode":"// pre-flight: does the page still embed __NEXT_DATA__ with network.id?\nconst html = await (await fetch(careersUrl)).text();\nconst m = html.match(/\"network\":\\s*\\{\"id\":\\s*\"?(\\d+)/);\nif (!m) console.warn(`No network.id in ${careersUrl} — set getro_collection on this entry`);","typeGuard":"function pageHasNetworkId(html) { return /__NEXT_DATA__/.test(html) && /\"network\"\\s*:\\s*\\{[^}]*\"id\"/.test(html); }","tryCatchPattern":"try {\n  const collectionId = await resolveCollectionId(entry, ctx, careersUrl);\n} catch (e) {\n  if (String(e.message).includes('could not resolve collection_id') && entry.getro_collection) {\n    return entry.getro_collection; // config override wins when scraping breaks\n  }\n  throw e;\n}","preventionTips":["Proactively pin getro_collection: N on Getro entries so scraping changes can't break scans","Periodically open Getro-powered careers pages in a browser to confirm structure hasn't changed","Watch for bot-challenge pages (Cloudflare) when the scraper user-agent gets stale"],"tags":["scraping","getro","dom-changed","collection-id"],"backgroundTag":"upstream-api-error","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"}