{"record":{"id":"d3e8794488aa4062","repo":"santifer/career-ops","slug":"invalid-format-entryformat-use-validforma","errorCode":null,"errorMessage":"invalid format \"${entryFormat}\" (use: ${validFormats.join(', ')})","messagePattern":"invalid format \"(.+?)\" \\(use: (.+?)\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"generate-pdf.mjs","lineNumber":1463,"sourceCode":"  } 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);\n\n      // Path-containment guards (realpath-based): keep the read and write inside\n      // the tracker workspace even through a symlinked ancestor. A batch\n      // manifest that escapes the workspace is malformed/tampered and is\n      // recorded as a per-entry failure rather than read or written.","sourceCodeStart":1445,"sourceCodeEnd":1481,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/generate-pdf.mjs#L1445-L1481","documentation":"Each batch manifest entry's paper format — the entry's own format field, falling back to the batch-global format — must be one of the valid formats ('a4', 'letter', compared case-insensitively). Any other value fails that entry with this error listing the accepted formats, because Chromium's page.pdf only supports those paper formats.","triggerScenarios":"A manifest entry or the global batch format set to something like \"A3\", \"legal\", \"A4 \" (with whitespace is fine — it's lowercased but not trimmed — actually \"a4 \".toLowerCase() is 'a4 ' which fails), \"iso-a4\", or a numeric/undefined-typed value that stringifies oddly.","commonSituations":"Users assuming other paper sizes (Legal, A3, A5) are supported; copy-pasting \"A4\" with a trailing space or BOM from a spreadsheet; config written for another tool that accepts \"iso-a4\".","solutions":["Change the entry's format (or the global format) to \"a4\" or \"letter\"","Check for hidden whitespace/BOM in the manifest value — retype the value as plain a4 or letter","Remove the per-entry format key entirely to inherit the valid global default","If you need another paper size, this tool does not support it — pre-render with your own Playwright page.pdf call using the desired format"],"exampleFix":"// before\n{\"input\": \"cv.html\", \"output\": \"cv.pdf\", \"format\": \"legal\"}\n// after\n{\"input\": \"cv.html\", \"output\": \"cv.pdf\", \"format\": \"letter\"}","handlingStrategy":"validation","validationCode":"const VALID_FORMATS = ['a4', 'letter'];\nconst fmt = String(spec.format ?? globalFormat ?? 'a4').toLowerCase().trim();\nif (!VALID_FORMATS.includes(fmt)) throw new Error(`invalid format \"${fmt}\" (use: ${VALID_FORMATS.join(', ')})`);","typeGuard":"const isValidFormat = (f) => typeof f === 'string' && ['a4', 'letter'].includes(f.toLowerCase().trim());","tryCatchPattern":"try {\n  await renderBatch(manifestPath);\n} catch (err) {\n  if (err.message.startsWith('invalid format')) {\n    console.error(err.message, '— fix the entry/global format field');\n    process.exit(1);\n  }\n  throw err;\n}","preventionTips":["Only use a4 or letter as format values in manifests and config","Trim/lowercase format values when generating manifests programmatically","Do not assume other paper sizes (legal, a3, a5) are supported — they are not","Keep the per-entry format unset to inherit a validated global default"],"tags":["manifest","validation","batch","enum"],"backgroundTag":"invalid-enum-value","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"}