laurent22/joplin · error · Error

No share found for folder ${folderId}

Error message

No share found for folder ${folderId}

What it means

Thrown by the helper `getShareUsers` in command-share.ts when no share object in the redux `shareService.shares` array has a `folder_id` equal to the given folderId. The helper is used while listing or modifying recipients, so a missing share means the folder is not currently shared from this client's viewpoint. The folderId is interpolated into the message for diagnostics.

Source

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

};


const folderTitle = (folder: FolderEntity|null) => {
	return folder ? substrWithEllipsis(folder.title, 0, 32) : _('[None]');
};

const getShareState = () => app().store().getState().shareService;
const getShareFromFolderId = (folderId: string) => {
	const shareState = getShareState();
	const allShares = shareState.shares;
	const share = allShares.find(share => share.folder_id === folderId);
	return share;
};

const getShareUsers = (folderId: string) => {
	const share = getShareFromFolderId(folderId);
	if (!share) {
		throw new Error(`No share found for folder ${folderId}`);
	}
	return getShareState().shareUsers[share.id];
};


class Command extends BaseCommand {
	public usage() {
		return 'share <command> [notebook] [user]';
	}

	public description() {
		return [
			_('Shares or unshares the specified [notebook] with [user]. Requires Joplin Cloud or Joplin Server.'),
			_('Commands: `add`, `remove`, `list`, `delete`, `accept`, `leave`, and `reject`.'),
		].join('\n');
	}

	public options() {

View on GitHub (pinned to 2654b33620)

Solutions

  1. Run `:sync` to refresh share state from the server, then retry.
  2. Confirm the folder is actually shared with `share list <notebook>` first.
  3. If the share was removed elsewhere, no action is needed — the error is correct.
  4. Verify you are logged into a Joplin Cloud or Joplin Server account that supports sharing.

Example fix

// before
const getShareUsers = (folderId: string) => {
	const share = getShareFromFolderId(folderId);
	if (!share) throw new Error(`No share found for folder ${folderId}`);
	return getShareState().shareUsers[share.id];
};

// after - return undefined and let callers decide, avoiding the misleading 'share missing' when only users are absent
const getShareUsers = (folderId: string) => {
	const share = getShareFromFolderId(folderId);
	if (!share) return undefined;
	return getShareState().shareUsers[share.id];
};
Defensive patterns

Strategy: validation

Validate before calling

const share = getShareFromFolderId(folderId);
if (!share) {
	throw new Error(`Folder ${folderId} is not shared (or share state is stale). Run \`:sync\` and \`share list\`.`);
}

Type guard

const isShared = (folderId: string, shares: ShareEntity[]): boolean => shares.some(s => s.folder_id === folderId);

Try / catch

try {
	await ShareService.instance().refreshShares();
	const users = getShareUsers(folderId);
} catch (e) {
	if (/No share found/.test(e.message)) { /* sync then retry, or surface to user */ }
	else throw e;
}

Prevention

When it happens

Trigger: Calling `share remove <notebook> <user>` or `share list <notebook>` on a folder whose share has not been loaded into redux state, was never shared, or was unshared in another client and not yet synced. Also after `refreshShares()` returns an empty/changed list because the share was revoked server-side.

Common situations: Running `share remove` before `share add`; race where the share was deleted by another collaborator; Joplin Cloud/Server account state is stale because sync has not run; testing against a non-sharing sync target (e.g. local filesystem) where shares never populate.

Related errors


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