RocketChat/Rocket.Chat · warning · Error

Custom fields not enabled

Error message

Custom fields not enabled

What it means

validateCustomMessageFields requires messageCustomFieldsEnabled === true (the Message_CustomFields_Enabled workspace setting); otherwise it throws a plain Error 'Custom fields not enabled'. Any send/update path that forwards message.customFields into validation will fail on workspaces where the custom-fields feature is switched off.

Source

Thrown at apps/meteor/server/lib/messaging/validateCustomMessageFields.ts:35

	},
	{ maxAge: 1000 * 60 },
);

export const validateCustomMessageFields = ({
	customFields,
	messageCustomFieldsEnabled,
	messageCustomFields,
}: {
	customFields: Record<string, any>;
	messageCustomFieldsEnabled: boolean;
	messageCustomFields: string;
}) => {
	// get the json schema for the custom fields of the message and validate it using ajv
	// if the validation fails, throw an error
	// if there are no custom fields, the message object remains unchanged

	if (messageCustomFieldsEnabled !== true) {
		throw new Error('Custom fields not enabled');
	}

	const validate = customFieldsValidate(messageCustomFields);
	if (!validate(customFields)) {
		throw new Error('Invalid custom fields');
	}
};

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Enable Message_CustomFields_Enabled in Administration -> Message if custom fields are wanted
  2. Clients/integrations: check the setting before attaching customFields to messages
  3. Omit customFields entirely on workspaces where the feature is off

Example fix

// before - integration always sends custom fields
await sendMessage(user, { ...message, customFields: { ticketId } }, room);

// after - only attach them when the workspace supports it
const payload = customFieldsEnabled
  ? { ...message, customFields: { ticketId } }
  : message;
await sendMessage(user, payload, room);
Defensive patterns

Strategy: validation

Validate before calling

// Check the public setting before attaching custom fields
const enabled = settingsCollection.findOne('_Message_CustomFields_Enabled')?.value === true;
const payload = enabled && customFields ? { ...message, customFields } : message;
await sendMessage(user, payload, room);

Try / catch

try {
  await sendMessage(user, { ...message, customFields }, room);
} catch (e) {
  if (e instanceof Error && e.message === 'Custom fields not enabled') {
    // strip customFields and resend without them, or surface the config gap
    await sendMessage(user, message, room);
  }
}

Prevention

When it happens

Trigger: Calling sendMessage or updateMessage with a customFields payload while Message_CustomFields_Enabled is false (it defaults to false); integrations assuming the feature is on because Message_CustomFields is configured.

Common situations: Setting the schema (Message_CustomFields) but forgetting to enable the toggle; deploying an integration to a workspace where the feature was never turned on; assuming enabled-by-default.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/1462a73b32cb259f. Report an issue: GitHub.