santifer/career-ops · warning

⚠️ config/profile.yml cv.sections lists only

Error message

⚠️  config/profile.yml cv.sections lists only "${displayTitle(order[0])}". An order needs at least two sections — one name states no relationship, so nothing was changed.

What it means

generate-pdf.mjs reorderCvSections() applies a user-supplied cv.sections order from config/profile.yml to the rendered CV HTML. An order array with a single entry states no ordering relationship, so the function is a no-op — it warns instead of silently ignoring, because the user would otherwise believe the setting took effect.

Solutions

  1. Add at least one more section name to cv.sections so an actual order is expressed
  2. If you only wanted one section emphasized, list the full desired order instead (all sections in sequence)
  3. If no reordering is desired, remove the cv.sections key entirely to silence the warning
  4. Regenerate the PDF after fixing the config

Example fix

# before: config/profile.yml
cv:
  sections:
    - experience
# after
cv:
  sections:
    - summary
    - experience
    - skills
Defensive patterns

Strategy: validation

Validate before calling

const order = profile.cv?.sections ?? [];
if (order.length === 1) console.warn('cv.sections needs at least two entries to express an order');

Type guard

const isApplicableSectionOrder = (order) => Array.isArray(order) && order.length >= 2;

Prevention

When it happens

Trigger: config/profile.yml contains `cv.sections:` with exactly one entry (order.length < 2) passed to reorderCvSections during PDF generation. The function returns the HTML unchanged and prints this warning.

Common situations: User trimming an old multi-entry sections list down to one section they care about; hand-editing profile.yml and not realizing an order needs at least two names to be meaningful.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at generate-pdf.mjs:916

 * too, in the order they should end up in.
 *
 * Runs before validateCvSectionOrder(), so the guard still judges what will
 * actually be printed — this satisfies the guard rather than bypassing it, which
 * is what separates it from --allow-reorder.
 *
 * No `cv.sections` → the input string is returned unchanged.
 *
 * @param {string} html
 * @param {string[]} order - Canonical section keys, e.g. ['skills', 'education'].
 * @returns {string}
 */
export function reorderCvSections(html, order) {
  if (!Array.isArray(order) || order.length === 0) return html;
  if (order.length < 2) {
    // Not an error, but not a no-op worth staying quiet about either: one name
    // states no relationship, so there is nothing to apply and the user would
    // otherwise be left thinking the setting took effect.
    console.warn(`⚠️  config/profile.yml cv.sections lists only "${displayTitle(order[0])}". An order needs at least two sections — one name states no relationship, so nothing was changed.`);
    return html;
  }

  // No early return on an empty block list: a CV whose sections are all
  // ambiguous produces none, and silently doing nothing is the failure mode
  // this feature exists to remove. The per-name loop below reports first.
  const { blocks, ambiguous, unrecognized } = extractSectionBlocks(html);

  const byKey = new Map();
  for (const block of blocks) {
    if (!byKey.has(block.key)) byKey.set(block.key, block);
  }

  const chosen = [];
  const unresolved = [];
  const seen = new Set();
  for (const name of order) {
    // `name` comes from a config file and is quoted straight into console

View on GitHub (pinned to aac998c7ed)