santifer/career-ops · warning

⚠️ (proceeding — --allow-reorder set)

Error message

⚠️  ${message} (proceeding — --allow-reorder set)

What it means

validateCvSectionOrder() in generate-pdf.mjs compares the section order of the rendered CV against the canonical order in cv.md. On divergence it throws unless --allow-reorder was passed, in which case it prints this warning and continues. The guard exists so CV sections never silently get reordered away from the user's authored source; --allow-reorder is the explicit opt-out.

Solutions

  1. If the reorder is unintended, align one side: either reorder sections in cv.md to match the template, or update templates/cv-template.html to render in cv.md's order.
  2. If the reorder is intended, keep passing --allow-reorder (the warning is informational and the render proceeds).
  3. Inspect renderedOrder vs sourceOrder printed in the message to see exactly which sections moved, then fix that specific section's position.
  4. If a recent edit to cv.md caused it, diff cv.md against the last known-good version to find the section move.

Example fix

// before (suppressing the guard every run)
node generate-pdf.mjs --allow-reorder
// after (fix the source order to match intent)
# cv.md
## Summary
## Experience
## Education
# template renders in the same sequence, no flag needed
node generate-pdf.mjs
Defensive patterns

Strategy: validation

Validate before calling

const authoredOrder = [...cvMd.matchAll(/^##\s+(.+)$/gm)].map(m => m[1].trim());
const templateOrder = ['Summary', 'Experience', 'Education', 'Skills']; // whatever the template renders
const same = JSON.stringify(authoredOrder) === JSON.stringify(templateOrder);
if (!same) console.warn('Section order mismatch — fix cv.md or template before generating PDF');

Try / catch

try {
  await generatePdf({ sections });
} catch (err) {
  if (err.message.includes('section order diverges')) {
    console.error('Reorder sections in cv.md to match the template, or re-run with --allow-reorder');
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling validateCvSectionOrder (indirectly via generate-pdf.mjs / the pdf mode) with allowReorder=true when the rendered section sequence differs from the cv.md source sequence — e.g. the template or tailoring step emits Summary/Education before Experience while cv.md lists them in another order, or a section is rendered in a different position than authored.

Common situations: Tailored CVs where an earlier step reorders sections to match a job posting; hand-edited cv.md after the template was customized with a fixed section order; adding a new section to cv.md that the template places in a different slot; running with --allow-reorder intentionally during template experimentation.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at generate-pdf.mjs:488

  if (findOrderDivergence(renderedComparable, sourcePositions) === -1) return;

  // Diverges from cv.md — but that alone isn't damning: it's also what every
  // CV tailored per modes/pdf.md's documented order looks like. Only treat it
  // as a real problem if it ALSO fails to match that canonical order.
  const canonicalComparable = rendered.filter(section => CANONICAL_TAILORED_POSITIONS.has(section.key));
  if (canonicalComparable.length >= 2
      && findOrderDivergence(canonicalComparable, CANONICAL_TAILORED_POSITIONS) === -1) {
    return;
  }

  const renderedOrder = renderedComparable.map(section => section.title).join(' -> ');
  const sourceOrder = source
    .filter(section => renderedComparable.some(renderedSection => renderedSection.key === section.key))
    .map(section => section.title)
    .join(' -> ');
  const message = `CV section order diverges from cv.md: rendered ${renderedOrder}; cv.md ${sourceOrder}`;
  if (allowReorder) {
    console.warn(`⚠️  ${message} (proceeding — --allow-reorder set)`);
    return;
  }
  throw new Error(message);
}

/**
 * Every canonical section key the alias table can produce, in template order.
 * Derived from the table rather than restated so the two cannot drift.
 */
export const CV_SECTION_KEYS = [...new Set(SECTION_ALIASES.values())];

// The all-caps comments the templates use to delimit sections, matched exactly
// as cv-sections-core.mjs matches them when stripping empty sections.
const SECTION_MARKER_RE = /<!--\s+[A-Z][A-Z ]*-->/g;
const SECTION_TITLE_RE = /class=["'][^"']*\bsection-title\b[^"']*["'][^>]*>([\s\S]*?)<\/[^>]+>/gi;

const DISPLAY_TITLE_MAX = 60;

View on GitHub (pinned to aac998c7ed)