santifer/career-ops · error

${message} (--strict-pages requested)

Error message

${message} (--strict-pages requested)

What it means

The strict variant of the page-budget failure: the rendered PDF has more pages than maxPages and --strict-pages was requested, so enforcePageBudget() throws instead of warning. The message states the actual and allowed page counts and names the recommended trim targets: lower-priority bullets, older roles, secondary projects, the competencies strip. Without --strict-pages the same condition is only a console warning.

Source

Thrown at generate-pdf.mjs:872

 * @returns {void}
 */
export function enforcePageBudget(pageCount, { maxPages = 2, strictPages = false } = {}) {
  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;

View on GitHub (pinned to 60398d6549)

Solutions

  1. Trim content per the message's priority list: lower-priority bullets first, then older roles, secondary projects, and the competencies strip; regenerate.
  2. If the market/role genuinely warrants it, raise max_pages in config/profile.yml (e.g. 2 for senior CVs).
  3. If the extra page is acceptable for this one render, drop --strict-pages to downgrade the failure to a warning — a conscious choice, not a fix.

Example fix

# before
node generate-pdf.mjs --strict-pages   # cv.md is 3 pages, max_pages: 2 -> throws

# after (option A: trim cv.md bullets/roles; option B:)
# config/profile.yml
max_pages: 3
Defensive patterns

Strategy: fallback

Validate before calling

// before a strict CI render, check the budget path is plausible:
// keep cv.md lean and assert bullet counts per role in a lint step
function cvBulletCount(cv) { return (cv.match(/^\s*- /gm) || []).length; }
if (cvBulletCount(cvMarkdown) > 45 && maxPages === 1) {
  console.warn('cv.md is likely over 1 page — trim before the strict render');
}

Try / catch

try {
  enforcePageBudget(pageCount, { maxPages, strictPages: true });
} catch (err) {
  if (err.message.includes('(--strict-pages requested)')) {
    // message names the trim targets: lower-priority bullets, older roles, secondary projects, competencies strip
    failBuildWithGuidance(err.message);
  } else throw err;
}

Prevention

When it happens

Trigger: cv.md grew past the budget (long career history) while profile.yml has max_pages: 1; CI gates that render with --strict-pages to enforce one-page CVs; a batch of tailored CVs where one variant added too many bullets.

Common situations: Senior candidates with many roles squeezing into max_pages: 1; strict quality gates in automated application pipelines; adding competencies/projects without removing equivalent content.

Related errors


AI-assisted analysis of santifer/career-ops@60398d6549 (2026-08-20). Data as JSON: /api/errors/8e7d9fbae30629f8. Report an issue: GitHub.