santifer/career-ops · error · Error
CV is ${pageCount} ${actualLabel}; the allowed maximum is ${
Error 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. (--strict-pages requested) What it means
Thrown by enforcePageBudget() in generate-pdf.mjs when strictPages is true and the rendered CV exceeds maxPages. Unlike the default warning-only path, --strict-pages turns overflow into a hard failure so CI/batch runs reject over-budget CVs. The message tells you exactly what to trim (lower-priority bullets, older roles, secondary projects, the competencies strip).
Source
Thrown at generate-pdf.mjs:301
* @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 9b17a8ac97)
Solutions
- Trim content per the message: cut lower-priority bullets, oldest roles, secondary projects, or the competencies strip, then regenerate.
- Raise maxPages if the role genuinely warrants it: generate-pdf --max-pages 3 --strict-pages.
- Drop --strict-pages locally to get a warning-only run while you iterate, then re-enable for the final gate.
- Use the pdf mode's content-selection flags to deprioritize older sections instead of editing cv.md destructively.
Example fix
// before
enforcePageBudget(count, { maxPages: 2, strictPages: true });
// 3-page CV throws
// after — raise budget for senior roles
enforcePageBudget(count, { maxPages: 3, strictPages: true });
// or remove strict for warning-only iteration
enforcePageBudget(count, { maxPages: 2, strictPages: false }); Defensive patterns
Strategy: validation
Validate before calling
null
Try / catch
try {
enforcePageBudget(count, { maxPages, strictPages: true });
} catch (e) {
if (e.message.includes('--strict-pages')) {
// over-budget in strict mode: surface to CI, request content trim or budget bump
core.setFailed(e.message);
} else throw e;
} Prevention
- Use --strict-pages in CI/release gates and warning-only during local iteration.
- Keep senior CVs within budget by maintaining a 'competencies strip' and dated roles that can be dropped.
- If a role genuinely needs more pages, raise maxPages explicitly rather than disabling strict.
- Run generate-pdf once non-strict to preview count before enabling the gate.
When it happens
Trigger: Running generate-pdf with --strict-pages (or strictPages:true) on a CV whose rendered page count is greater than maxPages (default 2). pageCount > maxPages AND strictPages === true.
Common situations: CI gate rejecting a CV that grew past 2 pages after adding a new role; a batch run with strictPages enabled on a dense senior CV; maxPages lowered from 2 to 1 without trimming content.
Related errors
- Invalid page budget "${maxPages}". Use a positive integer.
- CV section order diverges from cv.md: rendered ${renderedOrd
- Could not determine the rendered PDF page count (received ${
- Unsupported image type: ${extname(inputPath) || '(no extensi
- Invalid URL: ${url}
AI-assisted analysis of santifer/career-ops@9b17a8ac97 (2026-08-13).
Data as JSON: /api/errors/9683de02375813ec.
Report an issue: GitHub.