{"record":{"id":"51e3739aa3d1dd91","repo":"laurent22/joplin","slug":"no-share-found-for-folder-folder-id","errorCode":null,"errorMessage":"No share found for folder ${folder.id}","messagePattern":"No share found for folder (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-cli/app/command-share.ts","lineNumber":96,"sourceCode":"\t\t\t\tcan_read: 1,\n\t\t\t\tcan_write: args.options['read-only'] ? 0 : 1,\n\t\t\t};\n\t\t\tlogger.debug('Sharing folder', folder.id, 'with', email, 'permissions=', permissions);\n\n\t\t\tawait ShareService.instance().addShareRecipient(share.id, share.master_key_id, email, permissions);\n\n\t\t\tawait ShareService.instance().refreshShares();\n\t\t\tawait ShareService.instance().refreshShareUsers(share.id);\n\n\t\t\tawait reg.waitForSyncFinishedThenSync();\n\t\t};\n\n\t\tconst commandShareRemove = async (folder: FolderEntity, email: string) => {\n\t\t\tawait ShareService.instance().refreshShares();\n\n\t\t\tconst share = getShareFromFolderId(folder.id);\n\t\t\tif (!share) {\n\t\t\t\tthrow new Error(`No share found for folder ${folder.id}`);\n\t\t\t}\n\n\t\t\tawait ShareService.instance().refreshShareUsers(share.id);\n\n\t\t\tconst shareUsers = getShareUsers(folder.id);\n\t\t\tif (!shareUsers) {\n\t\t\t\tthrow new Error(`No share found for folder ${folder.id}`);\n\t\t\t}\n\n\t\t\tconst targetUser = shareUsers.find(user => user.user?.email === email);\n\t\t\tif (!targetUser) {\n\t\t\t\tthrow new Error(`No recipient found with email ${email}`);\n\t\t\t}\n\n\t\t\tawait ShareService.instance().deleteShareRecipient(targetUser.id);\n\t\t\tthis.stdout(_('Removed %s from share.', targetUser.user.email));\n\t\t};\n","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/app-cli/app/command-share.ts#L78-L114","documentation":"Thrown inside `commandShareRemove` after `ShareService.instance().refreshShares()` has been awaited, when the folder still has no share object in redux state. Because the refresh was just performed, this indicates the folder genuinely is not shared from the current account (rather than stale state). The folder.id is included for traceability.","triggerScenarios":"Running `share remove <notebook> <email>` on a folder that was never shared via `share add`, or whose share was already deleted on the server and the deletion has now propagated. The refresh-then-check sequence makes this a authoritative negative result.","commonSituations":"Calling `remove` instead of `delete` on a folder you own and have already unshared; the recipient was already removed by another admin; share was created on a different Joplin Cloud account.","solutions":["Verify current shares with `share list <notebook>`; if none, the recipient was already removed — nothing to do.","If you intended to unshare entirely, use `share delete <notebook>` instead of `share remove`.","Confirm you are logged into the same account that owns the share.","Sync and retry in case of a transient server-side inconsistency."],"exampleFix":"// before\nconst share = getShareFromFolderId(folder.id);\nif (!share) throw new Error(`No share found for folder ${folder.id}`);\n\n// after - guide the user to the right subcommand\nconst share = getShareFromFolderId(folder.id);\nif (!share) throw new Error(`Folder \"${folder.title}\" is not currently shared. Use \\`share delete\\` to unshare completely.`);","handlingStrategy":"validation","validationCode":"await ShareService.instance().refreshShares();\nconst share = getShareFromFolderId(folder.id);\nif (!share) {\n\tthrow new Error(`Cannot remove a recipient: folder \"${folder.title}\" is not shared.`);\n}","typeGuard":"null","tryCatchPattern":"try {\n\tawait commandShareRemove(folder, email);\n} catch (e) {\n\tif (/No share found/.test(e.message)) { /* tell user the folder is not shared */ }\n\telse throw e;\n}","preventionTips":["Verify the folder is shared via `share list <notebook>` before calling remove.","Use `share delete` when the goal is to unshare entirely rather than remove one recipient.","Sync before mutating share state."],"tags":["share","notebook","remove-recipient","cli","not-found"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}