can1357/oh-my-pi · error · Error

Usage: /export [--themes] [path]

Error message

Usage: /export [--themes] [path]

What it means

parseExportArgs parses the /export command arguments, which accept at most one optional path plus the --themes flag. Passing more than one non-flag token is rejected with this usage error because paths containing spaces were never supported — the parser splits on whitespace and cannot disambiguate multi-word paths.

Source

Thrown at packages/coding-agent/src/export/html/args.ts:18

/**
 * `/export` argument parsing, split from `./index.ts` so slash-command
 * registries can parse arguments without eagerly loading the export module's
 * embedded template/tool-view text.
 */

/** Dark and light TUI theme names bundled into a dual-theme export. */
export interface ExportThemeNames {
	dark: string;
	light: string;
}

/** Parse `/export [--themes] [path]`; paths containing spaces were never supported. */
export function parseExportArgs(args: string): { outputPath?: string; useUserThemes: boolean } {
	const parts = args.trim().split(/\s+/).filter(Boolean);
	const useUserThemes = parts.includes("--themes");
	const paths = parts.filter(part => part !== "--themes");
	if (paths.length > 1) throw new Error("Usage: /export [--themes] [path]");
	return { outputPath: paths[0], useUserThemes };
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Use a single path with no spaces (rename the target or use a path without spaces).
  2. Run `/export` with no arguments and let the default output path be chosen.
  3. Export to a spaces-free temp path, then move/rename the file.
  4. If a spaces-containing path is essential, export programmatically via exportSessionToHtml rather than the slash command.

Example fix

// before
/export my reports/session.html
// after
/export my-reports/session.html  # then mv to 'my reports/'
Defensive patterns

Strategy: validation

Validate before calling

const parts = args.trim().split(/\s+/).filter(Boolean).filter(p => p !== "--themes");
if (parts.length > 1) {
  throw new Error("/export accepts at most one path; quote-free paths with spaces are unsupported");
}

Type guard

null

Try / catch

try {
  const { outputPath } = parseExportArgs(userInput);
} catch (err) {
  ui.showHint("Usage: /export [--themes] [path] — one space-free path only");
}

Prevention

When it happens

Trigger: Running `/export my folder/out.html` (two whitespace-separated tokens) or `/export ~/a ~/b`; any input where filtering out --themes leaves 2+ path parts.

Common situations: Unquoted paths with spaces pasted into the command; accidentally pasting a path twice; assuming quote support that the parser doesn't implement.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/4d009fa069dcc28e. Report an issue: GitHub.