RocketChat/Rocket.Chat · error · Meteor.Error
error-direct-message-file-upload-not-allowed
error-direct-message-file-upload-not-allowed
Error message
File sharing not allowed in direct messages.
What it means
Error "File sharing not allowed in direct messages." thrown in RocketChat/Rocket.Chat.
Source
Thrown at apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts:173
const room = file.rid ? await Rooms.findOneById(file.rid) : undefined;
if (!isFederationUpload && !room) {
return false;
}
const directMessageAllowed = settings.get('FileUpload_Enabled_Direct');
const fileUploadAllowed = settings.get('FileUpload_Enabled');
if (!isFederationUpload && room && user?.type !== 'app' && (await canAccessRoomAsync(room, user, file)) !== true) {
return false;
}
const language = user?.language || 'en';
if (!fileUploadAllowed) {
const reason = i18n.t('FileUpload_Disabled', { lng: language });
throw new Meteor.Error('error-file-upload-disabled', reason);
}
if (room && !directMessageAllowed && room.t === 'd') {
const reason = i18n.t('File_not_allowed_direct_messages', { lng: language });
throw new Meteor.Error('error-direct-message-file-upload-not-allowed', reason);
}
// -1 maxFileSize means there is no limit
if (maxFileSize > -1 && (file.size || 0) > maxFileSize) {
const reason = i18n.t('File_exceeds_allowed_size_of_bytes', {
size: filesize(maxFileSize),
lng: language,
});
throw new Meteor.Error('error-file-too-large', reason);
}
if (!settings.get('E2E_Enable_Encrypt_Files') && isE2EEUpload(file)) {
const reason = i18n.t('Encrypted_file_not_allowed', { lng: language });
throw new Meteor.Error('error-invalid-file-type', reason);
}
// E2EE files should be of type application/octet-stream. no information about them should be disclosed on upload if they are encrypted
if (isE2EEUpload(file)) {View on GitHub (pinned to b2c16d5842)
Solutions
- Enable FileUpload_Enabled_Direct in Administration > File Upload to allow file sharing in direct messages.
- Send the file in a channel or private group instead of a direct message.
When it happens
Trigger: Thrown at apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts:173 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/e4703617a5f79a7a.
Report an issue: GitHub.