{"record":{"id":"736457daab2dec5d","repo":"santifer/career-ops","slug":"each-entry-needs-a-string-input-and-output","errorCode":null,"errorMessage":"each entry needs a string \"input\" and \"output\"","messagePattern":"each entry needs a string \"input\" and \"output\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"generate-pdf.mjs","lineNumber":1458,"sourceCode":"  // Prepare each entry. Preserve input order in the results by carrying the\n  // manifest index through renderBatch; prep failures land at their own index.\n  let cvMarkdown = '';\n  try {\n    cvMarkdown = await readFile(resolve(workspaceRoot, 'cv.md'), 'utf-8');\n  } catch (err) {\n    if (err?.code !== 'ENOENT') throw err;\n  }\n  // One profile governs the whole batch, so the declared order is read once\n  // rather than per entry. Anchored to workspaceRoot for the same reason the\n  // single render is: it is the anchor readStyleTokens() and the cv.md read\n  // already use, so one profile.yml supplies every setting.\n  const cvSectionOrder = readCvSectionOrder(resolve(workspaceRoot, 'config', 'profile.yml'));\n\n  for (let i = 0; i < manifest.length; i++) {\n    const spec = manifest[i];\n    try {\n      if (!spec || typeof spec.input !== 'string' || typeof spec.output !== 'string') {\n        throw new Error('each entry needs a string \"input\" and \"output\"');\n      }\n\n      const entryFormat = (spec.format || globals.format).toLowerCase();\n      if (!validFormats.includes(entryFormat)) {\n        throw new Error(`invalid format \"${entryFormat}\" (use: ${validFormats.join(', ')})`);\n      }\n\n      const entryReport = (spec.reportNum ?? '').toString().trim();\n      if (entryReport && !/^\\d+$/.test(entryReport)) {\n        throw new Error(`invalid reportNum \"${entryReport}\" (use the numeric report number)`);\n      }\n\n      // Resolve manifest-supplied input/output relative to the manifest's own\n      // directory, not process.cwd(), so a manifest renders identically wherever\n      // the batch is launched from. Absolute paths in the manifest still win\n      // (resolve() ignores the base when the tail is absolute).\n      const entryInput = resolve(manifestDir, spec.input);\n      const entryOutput = resolve(manifestDir, spec.output);","sourceCodeStart":1440,"sourceCodeEnd":1476,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/generate-pdf.mjs#L1440-L1476","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n[\n  {\"in\": \"cv-a.html\", \"output\": \"out/a.pdf\"},\n  {\"input\": \"cv-b.html\"}\n]\n// after\n[\n  {\"input\": \"cv-a.html\", \"output\": \"output/a.pdf\"},\n  {\"input\": \"cv-b.html\", \"output\": \"output/b.pdf\"}\n]","handlingStrategy":"validation","validationCode":"function validateManifest(manifest) {\n  if (!Array.isArray(manifest) || manifest.length === 0) throw new Error('manifest must be a non-empty array');\n  manifest.forEach((spec, i) => {\n    if (!spec || typeof spec.input !== 'string' || typeof spec.output !== 'string') {\n      throw new Error(`manifest[${i}] needs string \"input\" and \"output\"`);\n    }\n  });\n}\nvalidateManifest(JSON.parse(readFileSync(manifestPath, 'utf-8')));","typeGuard":"const isValidEntry = (spec) => Boolean(spec) && typeof spec === 'object' && typeof spec.input === 'string' && typeof spec.output === 'string';","tryCatchPattern":"try {\n  await renderBatch(manifestPath);\n} catch (err) {\n  if (err.message.includes('needs a string \"input\" and \"output\"')) {\n    console.error('Malformed manifest entry:', err.message);\n    process.exit(1);\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["manifest","validation","batch","json"],"backgroundTag":"schema-validation-failed","analyzedSha":"aac998c7ed7248ea853b720ceeb1fdbeb322fc5d","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}