{"record":{"id":"967d5fde885c1726","repo":"RocketChat/Rocket.Chat","slug":"error-evaluating-script","errorCode":null,"errorMessage":"error-evaluating-script","messagePattern":"error-evaluating-script","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/integrations/lib/isolated-vm/isolated-vm.ts","lineNumber":96,"sourceCode":"\t\t\t\t}),\n\t\t\t) as Partial<IScriptClass>;\n\n\t\t\tthis.compiledScripts[integration._id] = {\n\t\t\t\tscript: scriptFunctions,\n\t\t\t\tstore: {},\n\t\t\t\t_updatedAt: integration._updatedAt,\n\t\t\t};\n\n\t\t\treturn scriptFunctions;\n\t\t} catch (err: any) {\n\t\t\tthis.logger.error({\n\t\t\t\tmsg: 'Error evaluating integration script',\n\t\t\t\tintegration: integration.name,\n\t\t\t\tscript,\n\t\t\t\terr,\n\t\t\t});\n\n\t\t\tthrow new Error('error-evaluating-script');\n\t\t}\n\t}\n}\n","sourceCodeStart":78,"sourceCodeEnd":100,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/integrations/lib/isolated-vm/isolated-vm.ts#L78-L100","documentation":"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.","triggerScenarios":"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.","commonSituations":"Pasted scripts with typos or unbalanced braces; scripts using too-new ECMAScript syntax for the bundled runtime; truncated script content from copy/paste.","solutions":["Check logs for 'Error evaluating integration script' — it includes the script and the underlying error","Run the script through `node --check` (or an editor's JS linter) to find the syntax error, fix, and re-save","Stick to ES syntax supported by the platform's isolated-vm/Node version"],"exampleFix":"// before: pasting an unverified script into the integration editor\n// (unbalanced brace)\nmodule.exports = {\n  processOutgoingRequest({ request }) {\n    return { response: { headers: { 'content-type': 'application/json' } } };\n  }\n\n// after: verify syntax locally before pasting\n// $ node --check integration-script.js\nmodule.exports = {\n  processOutgoingRequest({ request }) {\n    return { response: { headers: { 'content-type': 'application/json' } } };\n  },\n};","handlingStrategy":"validation","validationCode":"// cheap syntax pre-check before enabling the integration's script\ntry {\n  new Function(script);\n} catch {\n  // syntax error: block saving/enabling and show it to the author\n}","typeGuard":null,"tryCatchPattern":"try {\n  await integrationScriptEngine.evaluate(integration);\n} catch (err) {\n  if (err instanceof Error && err.message === 'error-evaluating-script') {\n    // compile-time failure: fix the script syntax; logs hold the exact error\n    return;\n  }\n  throw err;\n}","preventionTips":["Run `node --check` (or an editor linter) on integration scripts before pasting them in","Limit scripts to ES syntax supported by the platform's isolated-vm/Node runtime","Watch the 'Error evaluating integration script' log entry — it includes the full failing script"],"tags":["integrations","scripting","isolated-vm","syntax-error"],"backgroundTag":"script-compile-error","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}