RocketChat/Rocket.Chat · error · Error

error-evaluating-script

Error message

error-evaluating-script

What it means

The isolated-vm-backed script evaluator failed while compiling/evaluating the integration script — a syntax error or vm-level failure at load time, before any method can run. The detailed cause is logged as 'Error evaluating integration script' (with the full script) and then rethrown as this generic error.

Source

Thrown at apps/meteor/server/lib/integrations/lib/isolated-vm/isolated-vm.ts:96

				}),
			) as Partial<IScriptClass>;

			this.compiledScripts[integration._id] = {
				script: scriptFunctions,
				store: {},
				_updatedAt: integration._updatedAt,
			};

			return scriptFunctions;
		} catch (err: any) {
			this.logger.error({
				msg: 'Error evaluating integration script',
				integration: integration.name,
				script,
				err,
			});

			throw new Error('error-evaluating-script');
		}
	}
}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Check logs for 'Error evaluating integration script' — it includes the script and the underlying error
  2. Run the script through `node --check` (or an editor's JS linter) to find the syntax error, fix, and re-save
  3. Stick to ES syntax supported by the platform's isolated-vm/Node version

Example fix

// before: pasting an unverified script into the integration editor
// (unbalanced brace)
module.exports = {
  processOutgoingRequest({ request }) {
    return { response: { headers: { 'content-type': 'application/json' } } };
  }

// after: verify syntax locally before pasting
// $ node --check integration-script.js
module.exports = {
  processOutgoingRequest({ request }) {
    return { response: { headers: { 'content-type': 'application/json' } } };
  },
};
Defensive patterns

Strategy: validation

Validate before calling

// cheap syntax pre-check before enabling the integration's script
try {
  new Function(script);
} catch {
  // syntax error: block saving/enabling and show it to the author
}

Try / catch

try {
  await integrationScriptEngine.evaluate(integration);
} catch (err) {
  if (err instanceof Error && err.message === 'error-evaluating-script') {
    // compile-time failure: fix the script syntax; logs hold the exact error
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Saving/enabling an integration whose script contains a syntax error, uses syntax unsupported by the platform's isolated-vm/Node version, or fails during sandbox setup — distinct from error-running-script, which is a script that compiles but throws at runtime.

Common situations: Pasted scripts with typos or unbalanced braces; scripts using too-new ECMAScript syntax for the bundled runtime; truncated script content from copy/paste.

Related errors


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