{"record":{"id":"5c92c0623ed86754","repo":"santifer/career-ops","slug":"message-continuing-because-overflow-is-warn","errorCode":null,"errorMessage":"⚠️  ${message} Continuing because overflow is warning-only by default; use --strict-pages to reject it.","messagePattern":"⚠️  (.+?) Continuing because overflow is warning-only by default; use --strict-pages to reject it\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"generate-pdf.mjs","lineNumber":1038,"sourceCode":"  if (!Number.isInteger(pageCount) || pageCount < 1) {\n    throw new Error(`Could not determine the rendered PDF page count (received ${pageCount}).`);\n  }\n  if (!Number.isInteger(maxPages) || maxPages < 1) {\n    throw new Error(`Invalid page budget \"${maxPages}\". Use a positive integer.`);\n  }\n  if (pageCount <= maxPages) return;\n\n  const actualLabel = 'pages';\n  const allowedLabel = maxPages === 1 ? 'page' : 'pages';\n  const message =\n    `CV is ${pageCount} ${actualLabel}; the allowed maximum is ${maxPages} ${allowedLabel}. ` +\n    'Trim lower-priority bullets, older roles, secondary projects, or the competencies strip, then regenerate.';\n\n  if (strictPages) {\n    throw new Error(`${message} (--strict-pages requested)`);\n  }\n\n  console.warn(`⚠️  ${message} Continuing because overflow is warning-only by default; use --strict-pages to reject it.`);\n}\n\n/**\n * Read the page count from the PDF catalog's root /Pages dictionary.\n *\n * Following the catalog reference keeps page-like text in content streams or\n * metadata from being mistaken for an actual page object.\n *\n * @param {Buffer} pdfBuffer - PDF bytes returned by Chromium.\n * @returns {number}\n */\nfunction countRenderedPdfPages(pdfBuffer) {\n  const pdf = pdfBuffer.toString('latin1');\n  const objects = new Map();\n  const objectPattern = /(?:^|[\\r\\n])(\\d+)\\s+(\\d+)\\s+obj\\b([\\s\\S]*?)\\bendobj\\b/g;\n\n  for (const match of pdf.matchAll(objectPattern)) {\n    const streamIndex = match[3].search(/\\bstream(?:\\r?\\n|\\r)/);","sourceCodeStart":1020,"sourceCodeEnd":1056,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/generate-pdf.mjs#L1020-L1056","documentation":"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.","triggerScenarios":"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)`.","commonSituations":"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.","solutions":["Trim content as the message advises: lower-priority bullets, older roles, secondary projects, or the competencies strip, then regenerate","Run with --strict-pages if you need generation to fail on overflow (e.g. CI gates)","Shorten the CV template's spacing/margins if trimming is not acceptable"],"exampleFix":"// before: overflow warning only\n$ node generate-pdf.mjs cv.html\n⚠️  CV exceeds 1 page ... Continuing...\n// after: strict mode rejects\n$ node generate-pdf.mjs cv.html --strict-pages\nError: CV exceeds 1 page ... (--strict-pages requested)","handlingStrategy":"validation","validationCode":"// estimate CV length before generating\nconst bulletCount = countBullets(cvMd);\nif (bulletCount > 30) console.warn('CV likely exceeds one page; trim before generating');","typeGuard":null,"tryCatchPattern":"try {\n  await generatePdf(input, { strictPages: process.argv.includes('--strict-pages') });\n} catch (err) {\n  if (err.message.includes('--strict-pages requested')) { console.error('CV overflows page limit'); process.exit(1); }\n  throw err;\n}","preventionTips":["Trim low-priority bullets/roles whenever content grows; regenerate and check page count","Use --strict-pages in CI so overflow fails the build instead of warning","Keep a one-page target in mind when adding roles or projects"],"tags":["pdf","cv","page-limit","cli"],"backgroundTag":"file-size-limit-exceeded","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"}