santifer/career-ops · error · Error
each entry needs a string "input" and "output"
Error message
each entry needs a string "input" and "output"
What it means
The batch renderer in generate-pdf.mjs validates each manifest entry: every element must be an object with string 'input' and string 'output' fields. An entry that is null/non-object, or whose input/output is missing or of another type, fails per-entry with this message instead of aborting the whole batch (the failure is recorded at that entry's index).
Solutions
- Fix the manifest entry so it has both "input" and "output" as non-empty strings
- Check for typos in the key names (must be exactly input/output, not in/out/source/target)
- Validate the manifest before running: it must be a non-empty JSON array of {input, output, format?, reportNum?} objects
- If generated by a script, log the offending entry (the error lands at the entry's index in results) and fix the generator's undefined/null handling
Example fix
// before
[
{"in": "cv-a.html", "output": "out/a.pdf"},
{"input": "cv-b.html"}
]
// after
[
{"input": "cv-a.html", "output": "output/a.pdf"},
{"input": "cv-b.html", "output": "output/b.pdf"}
] Defensive patterns
Strategy: validation
Validate before calling
function validateManifest(manifest) {
if (!Array.isArray(manifest) || manifest.length === 0) throw new Error('manifest must be a non-empty array');
manifest.forEach((spec, i) => {
if (!spec || typeof spec.input !== 'string' || typeof spec.output !== 'string') {
throw new Error(`manifest[${i}] needs string "input" and "output"`);
}
});
}
validateManifest(JSON.parse(readFileSync(manifestPath, 'utf-8'))); Type guard
const isValidEntry = (spec) => Boolean(spec) && typeof spec === 'object' && typeof spec.input === 'string' && typeof spec.output === 'string';
Try / catch
try {
await renderBatch(manifestPath);
} catch (err) {
if (err.message.includes('needs a string "input" and "output"')) {
console.error('Malformed manifest entry:', err.message);
process.exit(1);
}
throw err;
} Prevention
- Validate the manifest JSON against a small schema before running the batch
- Use exact key names input/output (not in/out) in hand-written manifests
- Guard generator scripts against emitting undefined/null paths
- Keep one committed example manifest in batch/ as the template
When it happens
Trigger: A batch manifest JSON containing entries like {"input": 123, "output": "out.pdf"}, {"input": "a.html"} (missing output), [null], or entries where input/output came from a template variable that resolved to undefined and was serialized out.
Common situations: Hand-written or script-generated manifests in batch/ with a missing comma or misnamed key ("in"/"out" instead of "input"/"output"); an upstream generator emitting undefined paths as null; copying an example manifest and leaving placeholder values.
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
- invalid format " " (use: )
- invalid reportNum " " (use the numeric report number)
- Existing candidates file at
- invalid golden case : need string id/jd and label.
- must be an array in
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/736457daab2dec5d.
Report an issue: GitHub.
Appendix: source
Thrown at generate-pdf.mjs:1458
// Prepare each entry. Preserve input order in the results by carrying the
// manifest index through renderBatch; prep failures land at their own index.
let cvMarkdown = '';
try {
cvMarkdown = await readFile(resolve(workspaceRoot, 'cv.md'), 'utf-8');
} catch (err) {
if (err?.code !== 'ENOENT') throw err;
}
// One profile governs the whole batch, so the declared order is read once
// rather than per entry. Anchored to workspaceRoot for the same reason the
// 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);View on GitHub (pinned to aac998c7ed)