laurent22/joplin · error · Error

No such invitation found

Error message

No such invitation found

What it means

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`.

Source

Thrown at packages/app-cli/app/command-share.ts:221

							} else {
								this.stdout(`\t${title} - ${share.itemId}`);
							}
						}
					} else {
						this.stdout(`\t${_('None')}`);
					}
				}
			}
		};

		const commandShareAcceptOrReject = async (folderId: string, accept: boolean) => {
			await ShareService.instance().maintenance();

			const shareState = getShareState();
			const invitations = shareState.shareInvitations.filter(invitation => {
				return invitation.share.folder_id === folderId && invitation.status === ShareUserStatus.Waiting;
			});
			if (invitations.length === 0) throw new Error('No such invitation found');

			// If there are multiple invitations for the same folder, stop early to avoid
			// accepting the wrong invitation.
			if (invitations.length > 1) throw new Error('Multiple invitations found with the same ID');

			const invitation = invitations[0];

			this.stdout(accept ? _('Accepting share...') : _('Rejecting share...'));
			await invitationRespond(invitation.id, invitation.share.folder_id, invitation.master_key, accept);
		};

		const commandShareAccept = (folderId: string) => (
			commandShareAcceptOrReject(folderId, true)
		);

		const commandShareReject = (folderId: string) => (
			commandShareAcceptOrReject(folderId, false)
		);

View on GitHub (pinned to 2654b33620)

Solutions

  1. Run `share list` (no notebook) to view incoming invitations and confirm which folder ids are Waiting.
  2. Run `:sync` to pull the latest invitation state, then retry.
  3. If the invitation is no longer Waiting, it has already been handled — no further action.

Example fix

// before
if (invitations.length === 0) throw new Error('No such invitation found');

// after - include the folderId and hint at the pending set
if (invitations.length === 0) throw new Error(`No pending invitation for folder ${folderId}. Run \`share list\` to see waiting invitations.`);
Defensive patterns

Strategy: validation

Validate before calling

const invitations = getShareState().shareInvitations.filter(
	i => i.share.folder_id === folderId && i.status === ShareUserStatus.Waiting,
);
if (invitations.length === 0) {
	throw new Error(`No pending invitation for folder ${folderId}. Run \`share list\`.`);
}

Type guard

const isWaitingInvitation = (i: ShareInvitation, folderId: string): boolean => i.share.folder_id === folderId && i.status === ShareUserStatus.Waiting;

Try / catch

try {
	await commandShareAccept(folderId);
} catch (e) {
	if (/No such invitation/.test(e.message)) { /* sync then show waiting invitations */ }
	else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of laurent22/joplin@2654b33620 (2026-08-12). Data as JSON: /api/errors/6f37b749739afab9. Report an issue: GitHub.