santifer/career-ops · error

careerviet: still contains job cards but none could be…

Error message

careerviet: ${url} still contains job cards but none could be parsed — the listing markup changed

What it means

careerviet's listing parser found job-card markers (`id="job-item-..."`) in the fetched HTML but extracted zero postings from them. The provider throws this instead of returning an empty array so that a markup change or anti-bot block is reported as a failure rather than silently showing the board as 'no openings', which would be indistinguishable from a healthy quiet board.

Solutions

  1. Open the URL in a browser and inspect the current job-card markup (ids, classes, href shape)
  2. Update the parsing regexes in providers/careerviet.mjs to match the new card structure
  3. Verify with a small Node script that parseListings extracts the same cards the marker regex finds
  4. If the page is being served an anti-bot variant, route fetching through the Playwright path instead of plain HTTP

Example fix

// before: parse regex expecting old anchor shape
const ANCHOR_RE = /job-item-[\w]+[^>]*>\s*<a[^>]*href="([^"]+)"/;
// after: match the redesigned card where the link is a sibling
const ANCHOR_RE = /id=["']job-item-[A-Za-z0-9]+["'][\s\S]{0,400}?<a[^>]+href=["']([^"'#]+)["']/;
Defensive patterns

Strategy: try-catch

Validate before calling

// Probe the fetched HTML before relying on parsed results
function looksLikeJobListing(html) {
  return typeof html === 'string' && /id=["']job-item-[A-Za-z0-9]+["']/.test(html);
}
// If looksLikeJobListing(html) && parsed.length === 0 -> markup drifted; alert instead of treating as empty

Type guard

function hasJobCards(html) {
  return typeof html === 'string' && /id=["']job-item-[A-Za-z0-9]+["']/.test(html);
}

Try / catch

try {
  const jobs = await provider.fetch(entry, ctx);
} catch (err) {
  if (String(err.message).includes('still contains job cards but none could be parsed')) {
    // markup change: flag board for maintenance, do NOT record as empty/quiet board
  } else { throw err; }
}

Prevention

When it happens

Trigger: The careerviet.vn listing page HTML still contains elements whose DOM id matches /job-item-[A-Za-z0-9]+/, but the card-parsing regexes (title/href extraction, COMPANY_RE, LOCATION_RE, window-open URL shapes) no longer match the surrounding markup — e.g. the board changed its card template, class names, or how job links are embedded.

Common situations: Careerviet redesigns its job-listing template or A/B tests a new card layout; a CDN or bot-protection layer rewrites the page; portals.yml is fine but the scraper's assumptions are stale after months of upstream drift.

Related errors


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

Appendix: source

Thrown at providers/careerviet.mjs:284

    });
  }

  return [...byId.values()];
}

/**
 * A listing page that parses to nothing is either a markup change or a block
 * — both are failures, and both must be reported. Returning [] would show up
 * as a board with no openings, indistinguishable from a healthy quiet board.
 *
 * The emptiness test is the card-marker SHAPE (a job-item DOM id) rather than
 * a marker word, so it survives the board's own "no results" copy changing.
 * @param {string} html
 * @param {string} url
 */
export function assertParsedSomething(html, url) {
  if (!/id=["']job-item-[A-Za-z0-9]+["']/.test(String(html ?? ''))) return;
  throw new Error(
    `careerviet: ${url} still contains job cards but none could be parsed — the listing markup changed`,
  );
}

/** @type {Provider} */
export default {
  id: 'careerviet',

  detect(entry) {
    return entry?.provider === 'careerviet' ? { url: buildListUrl(entry, 1) } : null;
  },

  async fetch(entry, ctx) {
    // `max_pages` on the portals entry is the user's setting; `ctx.maxPages` is a
    // caller-side bound — verify-portals' health probe passes 1. Same shape as itviec.mjs.
    const entryMaxPages = Number.isInteger(entry?.max_pages) && entry.max_pages > 0
      ? Math.min(entry.max_pages, MAX_PAGES_CAP)
      : DEFAULT_MAX_PAGES;

View on GitHub (pinned to aac998c7ed)