{"record":{"id":"0d628602dbd2a33b","repo":"RocketChat/Rocket.Chat","slug":"attached-t-no-files-found-to-prune-t-no-me","errorCode":null,"errorMessage":"attached ? t('No_files_found_to_prune') : t('No_messages_found_to_prune')","messagePattern":"attached \\? t\\('No_files_found_to_prune'\\) : t\\('No_messages_found_to_prune'\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"apps/meteor/client/views/room/contextualBar/PruneMessages/PruneMessagesWithData.tsx","lineNumber":95,"sourceCode":"\t\t\t\t}\n\n\t\t\t\tconst { count } = await pruneMessagesAction({\n\t\t\t\t\troomId: room._id,\n\t\t\t\t\tlatest: toDate.toISOString(),\n\t\t\t\t\toldest: fromDate.toISOString(),\n\t\t\t\t\tinclusive,\n\t\t\t\t\tlimit,\n\t\t\t\t\texcludePinned: pinned,\n\t\t\t\t\tfilesOnly: attached,\n\t\t\t\t\tignoreDiscussion: discussion,\n\t\t\t\t\tignoreThreads: threads,\n\t\t\t\t\tusers,\n\t\t\t\t});\n\n\t\t\t\tsetCounter(count);\n\n\t\t\t\tif (count < 1) {\n\t\t\t\t\tthrow new Error(attached ? t('No_files_found_to_prune') : t('No_messages_found_to_prune'));\n\t\t\t\t}\n\n\t\t\t\tdispatchToastMessage({\n\t\t\t\t\ttype: 'success',\n\t\t\t\t\tmessage: attached ? t('__count__file_pruned', { count }) : t('__count__message_pruned', { count }),\n\t\t\t\t});\n\t\t\t\tmethods.reset();\n\t\t\t} catch (error: unknown) {\n\t\t\t\tdispatchToastMessage({ type: 'error', message: error });\n\t\t\t} finally {\n\t\t\t\tcloseModal();\n\t\t\t}\n\t\t};\n\n\t\treturn setModal(\n\t\t\t<GenericModal\n\t\t\t\tvariant='danger'\n\t\t\t\tonClose={closeModal}","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/client/views/room/contextualBar/PruneMessages/PruneMessagesWithData.tsx#L77-L113","documentation":"Client-side flow guard in PruneMessagesWithContext: after calling the prune method with the chosen filters, the returned count of pruned messages/files is checked; count < 1 means nothing matched, and the handler throws a translated Error ('No_files_found_to_prune' or 'No_messages_found_to_prune') which the catch shows as an error toast. It converts an empty prune result into explicit user feedback and skips the success toast.","triggerScenarios":"Running 'Prune' with a filter combination (date range, users, pinned/exclude flags, filesOnly=attached, threads/discussions exclusions) that matches zero messages or zero files, so the server returns count 0.","commonSituations":"Pruning a channel whose messages in the range are all pinned or in threads when those are excluded; filesOnly=true but the room has no file attachments; overly narrow date ranges; already-pruned rooms.","solutions":["Widen the filters: extend the date range, include pinned messages, or disable 'ignore threads/discussions' exclusions.","If 'prune files' is checked, confirm the room actually contains attachments.","Treat the toast as informational — nothing matched, so nothing was deleted; adjust and retry."],"exampleFix":"// before\nif (count < 1) {\n  throw new Error(attached ? t('No_files_found_to_prune') : t('No_messages_found_to_prune'));\n}\n\n// after (UX alternative): show a warning toast without the error path\ndispatchToastMessage({\n  type: 'warning',\n  message: attached ? t('No_files_found_to_prune') : t('No_messages_found_to_prune'),\n});\nreturn;","handlingStrategy":"validation","validationCode":"// Before pruning: dry-run the same filters via the count endpoint\nconst count = await Meteor.callAsync('countPruneMessages', rid, { since, until, inclusive, excludePinned: pinned, filesOnly: attached, ignoreDiscussion: discussion, ignoreThreads: threads, users });\nif (count < 1) { /* widen filters or inform user; skip prune call */ }","typeGuard":null,"tryCatchPattern":"try { await prune(); } catch (e) { if (e instanceof Error && /No_(files|messages)_found_to_prune/.test(e.message)) { /* informational: nothing matched; adjust filters */ return; } throw e; }","preventionTips":["Check counts with the same filters before pruning.","Include pinned/threads/discussions when the room's content is mostly excluded.","Treat 'nothing to prune' as a no-op, not a failure."],"tags":["rocket-chat","prune-messages","moderation","i18n"],"backgroundTag":"empty-result-set","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}