nexu-io/open-design · error · Error

--deck cannot be combined with --page or --no-deck

Error message

--deck cannot be combined with --page or --no-deck

What it means

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.

Source

Thrown at apps/daemon/src/export-cli-request.ts:22

  fileName: string;
  format: ExportFormat;
  deck?: boolean;
  imageFormat?: ExportImageFormat;
  title?: string;
}

export interface ExportCliDeckModeOptions {
  format: ExportFormat;
  deck?: boolean;
  page?: boolean;
  noDeck?: boolean;
}

export function resolveExportCliDeckMode(options: ExportCliDeckModeOptions): boolean | undefined {
  const explicitDeck = options.deck === true;
  const explicitPage = options.page === true || options.noDeck === true;
  if (explicitDeck && explicitPage) {
    throw new Error('--deck cannot be combined with --page or --no-deck');
  }
  if (options.format === "pptx") {
    if (explicitPage) throw new Error('--page/--no-deck is not valid with --format pptx');
    return true;
  }
  if (explicitDeck) return true;
  if (explicitPage) return false;
  return undefined;
}

export function buildExportCliRequestBody(options: ExportCliRequestOptions): Record<string, unknown> {
  const deck = options.format === "pptx" ? true : options.deck;
  return {
    fileName: options.fileName,
    // PPTX is deck-only. For PDF/image, omit `deck` unless the caller explicitly
    // chooses deck/page mode so the daemon can still auto-detect by default.
    ...(deck !== undefined ? { deck } : {}),
    ...(options.format === "image" && options.imageFormat ? { imageFormat: options.imageFormat } : {}),

View on GitHub (pinned to 5be4028344)

Solutions

  1. Pass only one of --deck, --page, --no-deck. Omitting all three lets the daemon auto-detect.
  2. For PDF/image, --deck forces slide-deck export, --page/--no-deck forces single-page export.
  3. Audit shell scripts/aliases that build the export command for flag duplication.
  4. Validate the flag combination in your wrapper before calling od export.

Example fix

# before
od export --format pdf --deck --page out.pdf
# after — pick one mode
od export --format pdf --deck out.pdf
# or let the daemon auto-detect
od export --format pdf out.pdf
Defensive patterns

Strategy: validation

Validate before calling

function validateDeckFlags(o: { deck?: boolean; page?: boolean; noDeck?: boolean }): string | null {
  const deck = o.deck === true;
  const page = o.page === true || o.noDeck === true;
  if (deck && page) return 'Pass only one of --deck, --page, --no-deck (or omit all to auto-detect).';
  return null;
}
// call before resolveExportCliDeckMode

Try / catch

try {
  resolveExportCliDeckMode(opts);
} catch (err) {
  if (err instanceof Error && /cannot be combined/.test(err.message)) {
    console.error(err.message);  // user-facing CLI usage error
    process.exit(2);
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/97fa0c90b83b28ac. Report an issue: GitHub.