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
- Use a single path with no spaces (rename the target or use a path without spaces).
- Run `/export` with no arguments and let the default output path be chosen.
- Export to a spaces-free temp path, then move/rename the file.
- 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
- Never paste paths containing spaces into /export; rename or export to a temp path first.
- Pass at most one path token; use /export with no args to use the default output.
- Remember the parser does not handle quotes — quoting won't help.
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
- ${flag} requires a value
- Unknown security plan option: ${token}
- Unknown security cloud option: ${token}
- Usage: /security cloud <scans|start|status|pull>
- ${message}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/4d009fa069dcc28e.
Report an issue: GitHub.