{"record":{"id":"97fa0c90b83b28ac","repo":"nexu-io/open-design","slug":"deck-cannot-be-combined-with-page-or-no-deck","errorCode":null,"errorMessage":"--deck cannot be combined with --page or --no-deck","messagePattern":"--deck cannot be combined with --page or --no-deck","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/export-cli-request.ts","lineNumber":22,"sourceCode":"  fileName: string;\n  format: ExportFormat;\n  deck?: boolean;\n  imageFormat?: ExportImageFormat;\n  title?: string;\n}\n\nexport interface ExportCliDeckModeOptions {\n  format: ExportFormat;\n  deck?: boolean;\n  page?: boolean;\n  noDeck?: boolean;\n}\n\nexport function resolveExportCliDeckMode(options: ExportCliDeckModeOptions): boolean | undefined {\n  const explicitDeck = options.deck === true;\n  const explicitPage = options.page === true || options.noDeck === true;\n  if (explicitDeck && explicitPage) {\n    throw new Error('--deck cannot be combined with --page or --no-deck');\n  }\n  if (options.format === \"pptx\") {\n    if (explicitPage) throw new Error('--page/--no-deck is not valid with --format pptx');\n    return true;\n  }\n  if (explicitDeck) return true;\n  if (explicitPage) return false;\n  return undefined;\n}\n\nexport function buildExportCliRequestBody(options: ExportCliRequestOptions): Record<string, unknown> {\n  const deck = options.format === \"pptx\" ? true : options.deck;\n  return {\n    fileName: options.fileName,\n    // PPTX is deck-only. For PDF/image, omit `deck` unless the caller explicitly\n    // chooses deck/page mode so the daemon can still auto-detect by default.\n    ...(deck !== undefined ? { deck } : {}),\n    ...(options.format === \"image\" && options.imageFormat ? { imageFormat: options.imageFormat } : {}),","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/export-cli-request.ts#L4-L40","documentation":"Plain Error thrown by resolveExportCliDeckMode when the caller passes mutually exclusive deck-mode flags: --deck together with either --page or --no-deck. The function resolves a single ternary (deck | page | auto) and refuses to guess when the user has told it two contradictory things.","triggerScenarios":"Invoking the export CLI (or the function directly) with both deck:true and (page:true OR noDeck:true) set simultaneously. E.g. `od export ... --deck --page` or `od export ... --deck --no-deck`. The check fires before format-specific handling, so it applies to every format including pptx.","commonSituations":"User typos two flags on the command line; a script wrapper concatenating flags from multiple env sources; a CI job templating export commands that accidentally emits both; shell alias expansion adding --deck while the user also typed --page.","solutions":["Pass only one of --deck, --page, --no-deck. Omitting all three lets the daemon auto-detect.","For PDF/image, --deck forces slide-deck export, --page/--no-deck forces single-page export.","Audit shell scripts/aliases that build the export command for flag duplication.","Validate the flag combination in your wrapper before calling od export."],"exampleFix":"# before\nod export --format pdf --deck --page out.pdf\n# after — pick one mode\nod export --format pdf --deck out.pdf\n# or let the daemon auto-detect\nod export --format pdf out.pdf","handlingStrategy":"validation","validationCode":"function validateDeckFlags(o: { deck?: boolean; page?: boolean; noDeck?: boolean }): string | null {\n  const deck = o.deck === true;\n  const page = o.page === true || o.noDeck === true;\n  if (deck && page) return 'Pass only one of --deck, --page, --no-deck (or omit all to auto-detect).';\n  return null;\n}\n// call before resolveExportCliDeckMode","typeGuard":null,"tryCatchPattern":"try {\n  resolveExportCliDeckMode(opts);\n} catch (err) {\n  if (err instanceof Error && /cannot be combined/.test(err.message)) {\n    console.error(err.message);  // user-facing CLI usage error\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Pass at most one of --deck/--page/--no-deck per export command.","Audit shell scripts and aliases for flag duplication.","Omitting all three lets the daemon auto-detect, which is usually what you want."],"tags":["cli","validation","export","argument-conflict"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}