laurent22/joplin · error · Error
Unknown subcommand: ${args.command}
Error message
Unknown subcommand: ${args.command} What it means
Terminal fallback throw at the end of `share`'s action method: if `args.command` did not match any of the handled subcommands (add, remove, delete, leave, list, accept, reject), execution falls through to this throw. The unknown value is interpolated so the user sees what they typed. This is effectively an enum-validation failure on the subcommand.
Source
Thrown at packages/app-cli/app/command-share.ts:294
return CommandService.instance().execute(
'leaveSharedFolder', folder?.id, { force: args.options.force },
);
}
if (args.command === 'list') {
return commandShareList();
}
if (args.command === 'accept') {
return commandShareAccept(args.notebook);
}
if (args.command === 'reject') {
return commandShareReject(args.notebook);
}
throw new Error(`Unknown subcommand: ${args.command}`);
}
}
module.exports = Command;
View on GitHub (pinned to 2654b33620)
Solutions
- Check `:help share` for the valid subcommand list: add, remove, list, delete, accept, leave, reject.
- Fix the typo / casing and re-run.
- If scripting, validate `args.command` against the known set before invoking.
Example fix
// before
throw new Error(`Unknown subcommand: ${args.command}`);
// after - list valid subcommands in the message
throw new Error(`Unknown subcommand: "${args.command}". Valid subcommands: add, remove, list, delete, accept, leave, reject.`); Defensive patterns
Strategy: validation
Validate before calling
const VALID = ['add','remove','list','delete','accept','leave','reject'];
if (!VALID.includes(args.command)) {
throw new Error(`Unknown share subcommand "${args.command}". Valid: ${VALID.join(', ')}`);
} Type guard
const isShareSubcommand = (c: string): c is 'add'|'remove'|'list'|'delete'|'accept'|'leave'|'reject' => ['add','remove','list','delete','accept','leave','reject'].includes(c);
Try / catch
try {
await app().executeCommand(['share', subcommand]);
} catch (e) {
if (/Unknown subcommand/.test(e.message)) { /* show help, reprompt */ }
else throw e;
} Prevention
- Validate the subcommand against the known enum before invoking.
- Subcommand matching is case-sensitive lowercase — normalize input.
- Surface the full valid set in your error message.
When it happens
Trigger: Typing `:share foo`, `:share ad`, `:share Add` (case-sensitive match), or any unrecognized first token. Also triggered by passing an empty/undefined command.
Common situations: Typo in subcommand; casing mismatch (matching is exact, lowercase); outdated documentation naming a subcommand that does not exist; an empty command string from a malformed script.
Related errors
- [notebook] is required
- [user] is required
- Invalid command: "%s"
- No share found for folder ${folderId}
- No share found for folder ${folder.id}
AI-assisted analysis of laurent22/joplin@2654b33620 (2026-08-12).
Data as JSON: /api/errors/87fbbed3d2f032c7.
Report an issue: GitHub.