RocketChat/Rocket.Chat · info
attached ? t('No_files_found_to_prune') : t('No_messages_fou
Error message
attached ? t('No_files_found_to_prune') : t('No_messages_found_to_prune') What it means
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.
Source
Thrown at apps/meteor/client/views/room/contextualBar/PruneMessages/PruneMessagesWithData.tsx:95
}
const { count } = await pruneMessagesAction({
roomId: room._id,
latest: toDate.toISOString(),
oldest: fromDate.toISOString(),
inclusive,
limit,
excludePinned: pinned,
filesOnly: attached,
ignoreDiscussion: discussion,
ignoreThreads: threads,
users,
});
setCounter(count);
if (count < 1) {
throw new Error(attached ? t('No_files_found_to_prune') : t('No_messages_found_to_prune'));
}
dispatchToastMessage({
type: 'success',
message: attached ? t('__count__file_pruned', { count }) : t('__count__message_pruned', { count }),
});
methods.reset();
} catch (error: unknown) {
dispatchToastMessage({ type: 'error', message: error });
} finally {
closeModal();
}
};
return setModal(
<GenericModal
variant='danger'
onClose={closeModal}View on GitHub (pinned to b2c16d5842)
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.
Example fix
// before
if (count < 1) {
throw new Error(attached ? t('No_files_found_to_prune') : t('No_messages_found_to_prune'));
}
// after (UX alternative): show a warning toast without the error path
dispatchToastMessage({
type: 'warning',
message: attached ? t('No_files_found_to_prune') : t('No_messages_found_to_prune'),
});
return; Defensive patterns
Strategy: validation
Validate before calling
// Before pruning: dry-run the same filters via the count endpoint
const count = await Meteor.callAsync('countPruneMessages', rid, { since, until, inclusive, excludePinned: pinned, filesOnly: attached, ignoreDiscussion: discussion, ignoreThreads: threads, users });
if (count < 1) { /* widen filters or inform user; skip prune call */ } Try / catch
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; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Not allowed
- The required "roomId" or "roomName" param provided does not
- User not found
- User is not in this room
- User is already banned from this room
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/0d628602dbd2a33b.
Report an issue: GitHub.