koala73/worldmonitor · error

Missing comparison narrative for ' + page.slug

Error message

Missing comparison narrative for ' + page.slug

What it means

applyComparisonNarrative looks up a per-page narrative entry in COMPARISON_NARRATIVES keyed by page.slug and throws when no narrative exists. Every comparison page must have authored narrative content (FAQs, body copy, section prose) that this function merges in; a page without one cannot be rendered.

Solutions

  1. Add a COMPARISON_NARRATIVES entry keyed by the exact page.slug value.
  2. If the slug was renamed, update the narrative map key to the new slug.
  3. Check for typos between the page definition slug and the narrative key.
  4. Consider a fallback or explicit list of missing slugs so the error names all offenders at once.

Example fix

// before
const COMPARISON_NARRATIVES = { 'worldmonitor-vs-flightradar24': { ... } };
// after
const COMPARISON_NARRATIVES = {
  'worldmonitor-vs-flightradar24': { ... },
  'worldmonitor-vs-marinetraffic': { faqs: [], whyWeWinBody: [...], ... },
};
Defensive patterns

Strategy: validation

Validate before calling

const missing = PAGES.filter((p) => !COMPARISON_NARRATIVES[p.slug]);
if (missing.length) throw new Error('Missing narratives for: ' + missing.map((p) => p.slug).join(', '));

Type guard

const hasNarrative = (page) => Object.prototype.hasOwnProperty.call(COMPARISON_NARRATIVES, page.slug);

Try / catch

try {
  pages = pages.map(applyComparisonNarrative);
} catch (e) {
  if (String(e.message).startsWith('Missing comparison narrative')) {
    console.error('Add a COMPARISON_NARRATIVES entry for this slug:', e.message);
    process.exitCode = 1;
  } else throw e;
}

Prevention

When it happens

Trigger: Adding a new comparison page slug to the pages list in scripts/build-comparison-pages.mjs without adding a matching entry to the COMPARISON_NARRATIVES map, then running the build.

Common situations: Registering a new 'x-vs-y' comparison page but forgetting the narrative authoring step; renaming a slug so it no longer matches its narrative key; typo in the slug key.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of koala73/worldmonitor@7d06c8633d (2026-09-15). Data as JSON: /api/errors/639468073d5f5228. Report an issue: GitHub.

Appendix: source

Thrown at scripts/build-comparison-pages.mjs:447

    concessions: [
      ['International SOS', 'global assistance delivery: 27 assistance centers, medical evacuation, and case response'],
      ['Crisis24', 'duty-of-care coordination and traveler-tracking workflows'],
      ['Everbridge', 'mass notification and enterprise incident management'],
      ['Samdesk and Factal', 'dedicated social-signal verification desks'],
    ],
    whyWeWin: 'This is an intelligence layer, not a response capability. World Monitor sits alongside an assistance retainer as the always-on awareness feed: continuous multi-domain monitoring of conflict, aviation, maritime, and market signals that affect travelers, priced to cover the whole organization rather than only enrolled travelers. We cannot act on what we detect, and the page says so.',
    faqs: [
      ['Is World Monitor a Crisis24 alternative?', 'Not as a replacement. Crisis24 coordinates assistance; World Monitor is the always-on awareness feed that sits alongside an assistance retainer, covering conflict, aviation, maritime, and market signals. Buyers keep both: intelligence for awareness, assistance for response.'],
      ['Does World Monitor replace duty-of-care providers?', 'No. World Monitor has no assistance centers, no medical evacuation, and no mass notification, and it does not claim them. It covers the awareness layer that duty-of-care programs usually lack.'],
      ['What does travel risk intelligence cost?', 'World Monitor is free without signup, with Pro from $39.99/month. Assistance providers such as International SOS and Crisis24 negotiate enterprise retainers with undisclosed list pricing.'],
    ],
  },
];

function applyComparisonNarrative(page) {
  const narrative = COMPARISON_NARRATIVES[page.slug];
  if (!narrative) {
    throw new Error('Missing comparison narrative for ' + page.slug);
  }
  const faqs = [...page.faqs, ...(narrative.extraFaqs ?? [])];
  if (faqs.length < 8 || faqs.length > 12) {
    throw new Error(page.slug + ' FAQ count must be 8-12, got ' + faqs.length);
  }
  const faqNames = new Set();
  for (const [question] of faqs) {
    const key = String(question).trim().toLowerCase();
    if (faqNames.has(key)) {
      throw new Error(page.slug + ' duplicate FAQ question: ' + question);
    }
    faqNames.add(key);
  }
  const merged = { ...page, ...narrative, faqs };
  delete merged.extraFaqs;
  const whyBody = (merged.whyWeWinBody ?? []).join(' ').replace(/\s+/g, ' ').trim();
  if (!whyBody) {
    throw new Error(page.slug + ' is missing whyWeWinBody');

View on GitHub (pinned to 7d06c8633d)