RocketChat/Rocket.Chat · error · Error

integration-scripts-unknown-engine

Error message

integration-scripts-unknown-engine

What it means

validateScriptEngine throws this plain Error when a script engine name is supplied and it is not 'isolated-vm'. After the vm2 sandbox was removed, isolated-vm is the only supported engine for integration scripts, so legacy values like 'vm', 'vm2', 'eval', or 'nodejs' are rejected. The check runs whenever an integration's scriptEngine is validated, e.g. on save or before executing a script.

Source

Thrown at apps/meteor/server/lib/integrations/lib/validateScriptEngine.ts:13

import type { IntegrationScriptEngine } from '@rocket.chat/core-typings';
import { wrapExceptions } from '@rocket.chat/tools';

const FREEZE_INTEGRATION_SCRIPTS_VALUE = String(process.env.FREEZE_INTEGRATION_SCRIPTS).toLowerCase();
const FREEZE_INTEGRATION_SCRIPTS = ['yes', 'true'].includes(FREEZE_INTEGRATION_SCRIPTS_VALUE);

export const validateScriptEngine = (engine?: IntegrationScriptEngine) => {
	if (FREEZE_INTEGRATION_SCRIPTS) {
		throw new Error('integration-scripts-disabled');
	}

	if (engine && engine !== 'isolated-vm') {
		throw new Error('integration-scripts-unknown-engine');
	}

	const engineCode = 'ivm';

	if (engineCode === FREEZE_INTEGRATION_SCRIPTS_VALUE) {
		throw new Error('integration-scripts-isolated-vm-disabled');
	}

	return true;
};

export const isScriptEngineFrozen = (engine?: IntegrationScriptEngine) =>
	wrapExceptions(() => !validateScriptEngine(engine)).catch(() => true);

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Update the integration so scriptEngine is 'isolated-vm' (or omit it — validateOutgoingIntegration defaults it to 'isolated-vm')
  2. Re-save the integration through Admin -> Integrations so the default is applied to the stored record
  3. Test the script under the isolated-vm sandbox before flipping the field; older vm2 scripts may need adjustments

Example fix

// before — legacy record
await Integrations.updateAsync({ _id }, { $set: { scriptEngine: 'vm2' } });

// after
await Integrations.updateAsync({ _id }, { $set: { scriptEngine: 'isolated-vm' } });
Defensive patterns

Strategy: type-guard

Validate before calling

if (engine !== undefined && engine !== 'isolated-vm') {
  throw new RangeError(`unsupported script engine '${engine}'; only 'isolated-vm' is allowed`);
}

Type guard

const isSupportedScriptEngine = (e?: string): e is 'isolated-vm' | undefined =>
  e === undefined || e === 'isolated-vm';

Try / catch

try {
  validateScriptEngine(integration.scriptEngine);
} catch (err) {
  if (err instanceof Error && err.message === 'integration-scripts-unknown-engine') {
    // legacy record: reset scriptEngine to 'isolated-vm' (or omit) and re-save
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Saving or executing an integration whose record still carries scriptEngine 'vm'/'vm2' (typical for records created on Rocket.Chat versions before the engine migration); calling integrations.create/update with an explicit scriptEngine other than 'isolated-vm'.

Common situations: Workspaces upgraded across major versions with old integration records; API clients porting payloads from old documentation that showed other engine names; hand-edited database records.

Related errors


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