santifer/career-ops · warning

⚠️ Continuing because overflow is warning-only by default…

Error message

⚠️  ${message} Continuing because overflow is warning-only by default; use --strict-pages to reject it.

What it means

generate-pdf.mjs counts pages of the produced PDF against a page limit. Overflow is warning-only by default: the message describing the overflow (and trim suggestions) is printed with this 'Continuing' suffix and the PDF is still produced. Passing --strict-pages converts the same condition into a thrown Error and aborts.

Solutions

  1. Trim content as the message advises: lower-priority bullets, older roles, secondary projects, or the competencies strip, then regenerate
  2. Run with --strict-pages if you need generation to fail on overflow (e.g. CI gates)
  3. Shorten the CV template's spacing/margins if trimming is not acceptable

Example fix

// before: overflow warning only
$ node generate-pdf.mjs cv.html
⚠️  CV exceeds 1 page ... Continuing...
// after: strict mode rejects
$ node generate-pdf.mjs cv.html --strict-pages
Error: CV exceeds 1 page ... (--strict-pages requested)
Defensive patterns

Strategy: validation

Validate before calling

// estimate CV length before generating
const bulletCount = countBullets(cvMd);
if (bulletCount > 30) console.warn('CV likely exceeds one page; trim before generating');

Try / catch

try {
  await generatePdf(input, { strictPages: process.argv.includes('--strict-pages') });
} catch (err) {
  if (err.message.includes('--strict-pages requested')) { console.error('CV overflows page limit'); process.exit(1); }
  throw err;
}

Prevention

When it happens

Trigger: Generated CV exceeds the configured page limit and strictPages is false. The function prints `⚠️ ${message} Continuing because overflow is warning-only by default; use --strict-pages to reject it.` at generate-pdf.mjs:1037 instead of throwing `${message} (--strict-pages requested)`.

Common situations: CV content grew after adding roles/bullets and now spills to a second page; user generating a one-page CV for a role that requires it; batch PDF generation where overflow should fail CI — solved by --strict-pages.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


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

Appendix: source

Thrown at generate-pdf.mjs:1038

  if (!Number.isInteger(pageCount) || pageCount < 1) {
    throw new Error(`Could not determine the rendered PDF page count (received ${pageCount}).`);
  }
  if (!Number.isInteger(maxPages) || maxPages < 1) {
    throw new Error(`Invalid page budget "${maxPages}". Use a positive integer.`);
  }
  if (pageCount <= maxPages) return;

  const actualLabel = 'pages';
  const allowedLabel = maxPages === 1 ? 'page' : 'pages';
  const message =
    `CV is ${pageCount} ${actualLabel}; the allowed maximum is ${maxPages} ${allowedLabel}. ` +
    'Trim lower-priority bullets, older roles, secondary projects, or the competencies strip, then regenerate.';

  if (strictPages) {
    throw new Error(`${message} (--strict-pages requested)`);
  }

  console.warn(`⚠️  ${message} Continuing because overflow is warning-only by default; use --strict-pages to reject it.`);
}

/**
 * Read the page count from the PDF catalog's root /Pages dictionary.
 *
 * Following the catalog reference keeps page-like text in content streams or
 * metadata from being mistaken for an actual page object.
 *
 * @param {Buffer} pdfBuffer - PDF bytes returned by Chromium.
 * @returns {number}
 */
function countRenderedPdfPages(pdfBuffer) {
  const pdf = pdfBuffer.toString('latin1');
  const objects = new Map();
  const objectPattern = /(?:^|[\r\n])(\d+)\s+(\d+)\s+obj\b([\s\S]*?)\bendobj\b/g;

  for (const match of pdf.matchAll(objectPattern)) {
    const streamIndex = match[3].search(/\bstream(?:\r?\n|\r)/);

View on GitHub (pinned to aac998c7ed)