koala73/worldmonitor · error
writeAccuracySection requires the canonical DataCatalog iden
Error message
writeAccuracySection requires the canonical DataCatalog identity so the scorecard Dataset joins the catalog graph
What it means
writeAccuracySection builds the /accuracy/ page and its JSON-LD structured data. It requires both the DataCatalog node and the dataset's catalog reference to carry canonical '@id' values so the scorecard Dataset entity links into the catalog's knowledge graph. When either identity is missing the function throws instead of emitting broken/invalid structured data.
Solutions
- Ensure the dataCatalog object passed in includes a canonical '@id' URL.
- Ensure each dataset has dataset.catalog['@id'] pointing at the catalog's canonical identity.
- Check where datasets are constructed/loaded and add the catalog linkage for any newly added dataset.
- Add a pre-flight check on the dataset config so missing identities fail with a clearer message.
Example fix
// before
writeAccuracySection({ dataset: { name: 'conflicts' }, snapshotPath });
// after
writeAccuracySection({
dataset: { name: 'conflicts', catalog: { '@id': 'https://worldmonitor.app/#datacatalog' } },
dataCatalog: { '@id': 'https://worldmonitor.app/#datacatalog' },
snapshotPath,
}); Defensive patterns
Strategy: validation
Validate before calling
for (const d of datasets) {
if (!dataCatalog?.['@id']) throw new Error('dataCatalog missing @id');
if (!d.catalog?.['@id']) throw new Error(`dataset ${d.name} missing catalog @id`);
} Type guard
const hasCatalogIdentity = (d) => typeof d?.catalog?.['@id'] === 'string' && d.catalog['@id'].length > 0;
Try / catch
try {
writeAccuracySection({ dataset, dataCatalog, snapshotPath });
} catch (e) {
if (String(e.message).includes('canonical DataCatalog identity')) {
console.error('Wire dataset/catalog @id before building /accuracy/:', e.message);
} else throw e;
} Prevention
- Centralize catalog '@id' construction in one helper and reuse it for every dataset.
- Validate the whole dataset registry (catalog linkage included) before any page build step.
- Add a schema/type for dataset entries that makes catalog['@id'] required.
When it happens
Trigger: Calling writeAccuracySection (or the build script) with dataCatalog undefined/null or without '@id', or with dataset.catalog missing its '@id' field.
Common situations: Adding a new dataset entry without wiring it into the DataCatalog registry; refactoring the JSON-LD builders and dropping the '@id' field; passing a partial catalog object in a test harness.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- /accuracy/ meta description must be 155–160 chars (got ${len
- FAQ count must be 8-12, got ' + faqs.length
- H2 "' + merged.heading + '" has no following prose
- Missing comparison narrative for ' + page.slug
- duplicate FAQ question: ' + question
AI-assisted analysis of koala73/worldmonitor@7d06c8633d (2026-09-15).
Data as JSON: /api/errors/2a2621b061b4202c.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/build-accuracy-page.mjs:732
confidenceIntervals: { published: false, trackedIn: CONFIDENCE_INTERVAL_ISSUE },
horizonProjections: { scored: false, trackedIn: HORIZON_SCORING_ISSUE },
scorecard: state.scorecard,
};
return `${JSON.stringify(payload, null, 2)}\n`;
}
export function writeAccuracySection({
outDir,
baseUrl,
tpl,
section,
lastmod = ACCURACY_CONTENT_VERSION,
dataset,
dataCatalog,
snapshotPath,
}) {
if (!dataCatalog?.['@id'] || !dataset?.catalog?.['@id']) {
throw new Error(
'writeAccuracySection requires the canonical DataCatalog identity so the scorecard Dataset joins the catalog graph',
);
}
const state = classifyAccuracyState(section);
mkdirSync(join(outDir, 'accuracy'), { recursive: true });
writeFileSync(
join(outDir, 'accuracy', 'index.html'),
renderAccuracyPage({ baseUrl, tpl, state, lastmod, dataset, dataCatalog, snapshotPath }),
);
const downloadPath = join(outDir, dataset.file);
mkdirSync(dirname(downloadPath), { recursive: true });
writeFileSync(downloadPath, accuracyDatasetDownload({ state, snapshotPath }));
return { state };
}
View on GitHub (pinned to 7d06c8633d)