santifer/career-ops · error · Error
invalid reportNum " " (use the numeric report number)
Error message
invalid reportNum "${entryReport}" (use the numeric report number) What it means
generate-pdf.mjs batch rendering validates each manifest entry's optional reportNum: it must be a purely numeric report number (digits only). The throw fires when a batch manifest supplies a reportNum containing non-digit characters — e.g. a filename, a markdown link, or a '#42'-style reference — instead of the bare numeric id used across reports/ and the tracker.
Solutions
- Edit the batch manifest and set reportNum to the bare numeric id, e.g. "042".
- If the field is not needed, remove reportNum (or set it to null/empty) — it is optional.
- If generating manifests programmatically, extract digits from the tracker link before writing the field: `String(link.match(/\d+/)?.[0] ?? '')`.
Example fix
// before (manifest entry)
{ "input": "out/042.html", "output": "out/042.pdf", "reportNum": "reports/042-foo.md" }
// after
{ "input": "out/042.html", "output": "out/042.pdf", "reportNum": "042" } Defensive patterns
Strategy: validation
Validate before calling
const reportNum = (spec.reportNum ?? '').toString().trim();
if (reportNum && !/^\d+$/.test(reportNum)) {
throw new Error(`reportNum must be numeric, got: ${reportNum}`);
} Type guard
const isValidReportNum = (v) => v == null || /^\d*$/.test(String(v).trim());
Try / catch
try {
await runBatch(manifest);
} catch (err) {
if (err.message.includes('invalid reportNum')) {
console.error(`Fix manifest entry ${spec.id}: ${err.message}`);
} else throw err;
} Prevention
- Extract reportNum from tracker links with a regex on digits, never paste the whole markdown link.
- Validate the whole manifest with a JSON schema before launching the batch.
- Leave reportNum absent when you don't need report linkage.
When it happens
Trigger: Running a batch render whose manifest entry has reportNum set to something like 'reports/042.md', '#042', '042-cv', or a slug; any whitespace-trimmed value failing /^\d+$/ throws.
Common situations: Hand-authored batch manifests where the author pasted the tracker row link or the report filename into reportNum; scripts that copy the whole markdown link `[042](reports/...)` instead of extracting the number; empty string is allowed (optional field), so the error only occurs on a non-empty malformed value.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- each entry needs a string "input" and "output"
- invalid format " " (use: )
- plugin rejected
- 4dayweek: invalid URL
- 4dayweek: URL must use HTTPS
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/fd3a6645377af067.
Report an issue: GitHub.
Appendix: source
Thrown at generate-pdf.mjs:1468
// single render is: it is the anchor readStyleTokens() and the cv.md read
// already use, so one profile.yml supplies every setting.
const cvSectionOrder = readCvSectionOrder(resolve(workspaceRoot, 'config', 'profile.yml'));
for (let i = 0; i < manifest.length; i++) {
const spec = manifest[i];
try {
if (!spec || typeof spec.input !== 'string' || typeof spec.output !== 'string') {
throw new Error('each entry needs a string "input" and "output"');
}
const entryFormat = (spec.format || globals.format).toLowerCase();
if (!validFormats.includes(entryFormat)) {
throw new Error(`invalid format "${entryFormat}" (use: ${validFormats.join(', ')})`);
}
const entryReport = (spec.reportNum ?? '').toString().trim();
if (entryReport && !/^\d+$/.test(entryReport)) {
throw new Error(`invalid reportNum "${entryReport}" (use the numeric report number)`);
}
// Resolve manifest-supplied input/output relative to the manifest's own
// directory, not process.cwd(), so a manifest renders identically wherever
// the batch is launched from. Absolute paths in the manifest still win
// (resolve() ignores the base when the tail is absolute).
const entryInput = resolve(manifestDir, spec.input);
const entryOutput = resolve(manifestDir, spec.output);
// Path-containment guards (realpath-based): keep the read and write inside
// the tracker workspace even through a symlinked ancestor. A batch
// manifest that escapes the workspace is malformed/tampered and is
// recorded as a per-entry failure rather than read or written.
assertInsideWorkspace(entryInput, 'input');
if (!isWorkspaceOutputPath(entryOutput, workspaceRoot)) {
throw new Error(`output escapes the tracker workspace: ${entryOutput}`);
}
View on GitHub (pinned to aac998c7ed)