RocketChat/Rocket.Chat · error · Meteor.Error
error-message-size-exceeded
error-message-size-exceeded
Error message
error-message-size-exceeded
What it means
Thrown by POST /api/v1/rooms.mediaConfirm/:rid/:fileId when this.bodyParams.description length exceeds the Message_MaxAllowedSize workspace setting (the message character limit). The description will become the file message's text, so it is capped like any message; a missing description passes because the check uses ?.length ?? 0.
Solutions
- Truncate the description client-side before calling mediaConfirm
- Or raise Message_MaxAllowedSize in Administration > General > Message (requires admin)
- Move oversized text into the file itself instead of the description
Example fix
// before
await sdk.post(`rooms.mediaConfirm/${rid}/${fileId}`, { description: longTranscript });
// after
const MAX = 5000; // keep in sync with Message_MaxAllowedSize
await sdk.post(`rooms.mediaConfirm/${rid}/${fileId}`, { description: longTranscript.slice(0, MAX) }); Defensive patterns
Strategy: validation
Validate before calling
const MAX = 5000; // keep in sync with Message_MaxAllowedSize if ((description ?? '').length > MAX) description = description.slice(0, MAX);
Try / catch
try {
await sdk.post(`rooms.mediaConfirm/${rid}/${fileId}`, { description });
} catch (e: any) {
if (e?.response?.data?.errorType === 'error-message-size-exceeded') {
return sdk.post(`rooms.mediaConfirm/${rid}/${fileId}`, { description: description.slice(0, MAX) });
}
throw e;
} Prevention
- Cap generated captions at the workspace message limit before sending
- Read Message_MaxAllowedSize from server settings where available
- Push oversized text into the file payload, not the description
When it happens
Trigger: POST mediaConfirm with a long caption/description body parameter on a workspace where Message_MaxAllowedSize is at or below the default 5000 chars; descriptions assembled from logs or transcripts exceeding the cap.
Common situations: Auto-generated captions (OCR output, transcripts, log excerpts) longer than the message limit; workspaces where admins lowered Message_MaxAllowedSize but clients assumed 5000; pasting large error dumps as file descriptions.
Related errors
- error-no-file-uploaded
- invalid-field-content
- emoji-is-not-image
- error-action-not-allowed
- error-avatar-invalid-content-type
AI-assisted analysis of RocketChat/Rocket.Chat@e4b8178b20 (2026-08-18).
Data as JSON: /api/errors/a2dedc168ea60425.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/server/api/v1/rooms.ts:346
);
API.v1.addRoute(
'rooms.mediaConfirm/:rid/:fileId',
{ authRequired: true },
{
async post() {
if (!(await canAccessRoomIdAsync(this.urlParams.rid, this.userId))) {
return API.v1.forbidden();
}
const file = await Uploads.findOneByIdAndUserIdAndRoomId(this.urlParams.fileId, this.userId, this.urlParams.rid);
if (!file) {
throw new Meteor.Error('invalid-file');
}
if ((this.bodyParams.description?.length ?? 0) > settings.get<number>('Message_MaxAllowedSize')) {
throw new Meteor.Error('error-message-size-exceeded');
}
file.description = this.bodyParams.description;
delete this.bodyParams.description;
if (this.bodyParams.fileName) {
file.name = this.bodyParams.fileName;
delete this.bodyParams.fileName;
}
if (this.bodyParams.fileContent) {
file.content = this.bodyParams.fileContent;
delete this.bodyParams.fileContent;
}
await applyAirGappedRestrictionsValidation(() =>
sendFileMessage(this.userId, { roomId: this.urlParams.rid, file, msgData: this.bodyParams }),
);View on GitHub (pinned to e4b8178b20)