{"record":{"id":"6f37b749739afab9","repo":"laurent22/joplin","slug":"no-such-invitation-found","errorCode":null,"errorMessage":"No such invitation found","messagePattern":"No such invitation found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-cli/app/command-share.ts","lineNumber":221,"sourceCode":"\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.stdout(`\\t${title} - ${share.itemId}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.stdout(`\\t${_('None')}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst commandShareAcceptOrReject = async (folderId: string, accept: boolean) => {\n\t\t\tawait ShareService.instance().maintenance();\n\n\t\t\tconst shareState = getShareState();\n\t\t\tconst invitations = shareState.shareInvitations.filter(invitation => {\n\t\t\t\treturn invitation.share.folder_id === folderId && invitation.status === ShareUserStatus.Waiting;\n\t\t\t});\n\t\t\tif (invitations.length === 0) throw new Error('No such invitation found');\n\n\t\t\t// If there are multiple invitations for the same folder, stop early to avoid\n\t\t\t// accepting the wrong invitation.\n\t\t\tif (invitations.length > 1) throw new Error('Multiple invitations found with the same ID');\n\n\t\t\tconst invitation = invitations[0];\n\n\t\t\tthis.stdout(accept ? _('Accepting share...') : _('Rejecting share...'));\n\t\t\tawait invitationRespond(invitation.id, invitation.share.folder_id, invitation.master_key, accept);\n\t\t};\n\n\t\tconst commandShareAccept = (folderId: string) => (\n\t\t\tcommandShareAcceptOrReject(folderId, true)\n\t\t);\n\n\t\tconst commandShareReject = (folderId: string) => (\n\t\t\tcommandShareAcceptOrReject(folderId, false)\n\t\t);","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/app-cli/app/command-share.ts#L203-L239","documentation":"Thrown by `commandShareAcceptOrReject` when filtering `shareState.shareInvitations` for entries whose `share.folder_id` matches the given folderId AND whose status is `ShareUserStatus.Waiting` yields zero results. The command therefore cannot find a pending invitation to act on. Used by both `share accept` and `share reject`.","triggerScenarios":"Running `share accept <notebook>` / `share reject <notebook>` when there is no Waiting invitation for that folder — either because it was already accepted/rejected, expired server-side, or never existed. Note the filter keys on folder_id, so passing the wrong notebook (e.g. one you own rather than one shared with you) also yields zero matches.","commonSituations":"Trying to accept an invitation you already handled; the invitation was revoked by the sender; passing a notebook id that is a share you OWN (invitations only exist for incoming shares); sync has not pulled the latest invitation list.","solutions":["Run `share list` (no notebook) to view incoming invitations and confirm which folder ids are Waiting.","Run `:sync` to pull the latest invitation state, then retry.","If the invitation is no longer Waiting, it has already been handled — no further action."],"exampleFix":"// before\nif (invitations.length === 0) throw new Error('No such invitation found');\n\n// after - include the folderId and hint at the pending set\nif (invitations.length === 0) throw new Error(`No pending invitation for folder ${folderId}. Run \\`share list\\` to see waiting invitations.`);","handlingStrategy":"validation","validationCode":"const invitations = getShareState().shareInvitations.filter(\n\ti => i.share.folder_id === folderId && i.status === ShareUserStatus.Waiting,\n);\nif (invitations.length === 0) {\n\tthrow new Error(`No pending invitation for folder ${folderId}. Run \\`share list\\`.`);\n}","typeGuard":"const isWaitingInvitation = (i: ShareInvitation, folderId: string): boolean => i.share.folder_id === folderId && i.status === ShareUserStatus.Waiting;","tryCatchPattern":"try {\n\tawait commandShareAccept(folderId);\n} catch (e) {\n\tif (/No such invitation/.test(e.message)) { /* sync then show waiting invitations */ }\n\telse throw e;\n}","preventionTips":["Run `share list` to see waiting invitations and copy the exact folder id.","Sync before accept/reject so the invitation list is current.","Remember invitations only exist for INCOMING shares, not folders you own."],"tags":["share","invitation","accept","reject","cli","not-found"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}