{"record":{"id":"87fbbed3d2f032c7","repo":"laurent22/joplin","slug":"unknown-subcommand-args-command","errorCode":null,"errorMessage":"Unknown subcommand: ${args.command}","messagePattern":"Unknown subcommand: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-cli/app/command-share.ts","lineNumber":294,"sourceCode":"\n\t\t\treturn CommandService.instance().execute(\n\t\t\t\t'leaveSharedFolder', folder?.id, { force: args.options.force },\n\t\t\t);\n\t\t}\n\n\t\tif (args.command === 'list') {\n\t\t\treturn commandShareList();\n\t\t}\n\n\t\tif (args.command === 'accept') {\n\t\t\treturn commandShareAccept(args.notebook);\n\t\t}\n\n\t\tif (args.command === 'reject') {\n\t\t\treturn commandShareReject(args.notebook);\n\t\t}\n\n\t\tthrow new Error(`Unknown subcommand: ${args.command}`);\n\t}\n}\n\nmodule.exports = Command;\n","sourceCodeStart":276,"sourceCodeEnd":299,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/app-cli/app/command-share.ts#L276-L299","documentation":"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.","triggerScenarios":"Typing `:share foo`, `:share ad`, `:share Add` (case-sensitive match), or any unrecognized first token. Also triggered by passing an empty/undefined command.","commonSituations":"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.","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."],"exampleFix":"// before\nthrow new Error(`Unknown subcommand: ${args.command}`);\n\n// after - list valid subcommands in the message\nthrow new Error(`Unknown subcommand: \"${args.command}\". Valid subcommands: add, remove, list, delete, accept, leave, reject.`);","handlingStrategy":"validation","validationCode":"const VALID = ['add','remove','list','delete','accept','leave','reject'];\nif (!VALID.includes(args.command)) {\n\tthrow new Error(`Unknown share subcommand \"${args.command}\". Valid: ${VALID.join(', ')}`);\n}","typeGuard":"const isShareSubcommand = (c: string): c is 'add'|'remove'|'list'|'delete'|'accept'|'leave'|'reject' =>\n\t['add','remove','list','delete','accept','leave','reject'].includes(c);","tryCatchPattern":"try {\n\tawait app().executeCommand(['share', subcommand]);\n} catch (e) {\n\tif (/Unknown subcommand/.test(e.message)) { /* show help, reprompt */ }\n\telse throw e;\n}","preventionTips":["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."],"tags":["share","invalid-command","argument-validation","cli"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}